Subject: Feedback Window patch

From: [email-masked]
Date: Wed, 9 Dec 1998 11:18:54 -0500 (EST)

I have had a "problem" in that my fvwm2 configuration works a bit
differently between my home systems and my office systems.  The
"feedback" window that displays during an interactive move displays on
the top-left corner at work, and is centered at home.  I checked out
the fvwm2 man page, checking "Resize" and "Move" and doing searches
for "feedback" etc to no avail...  what caused this difference in
behavior????

Well, instead of asking a question on the list, I decided that I had
the sources in front of me, and I could track down how that little
window is created and found out, surprise!  It was a MENU STYLE
setting!

Since it is not intuitive that a menu style should affect something
that isn't really associated with menus, I decided to make a fix so
that the location of the feedback window can be specifically set by
the user.

The attached patch adds a new builtin function "FeedbackWindow" to
fvwm, which takes a single option:  "center" (locate the window in the
center of the screen), "topleft" (locate the window in the top left
corner of the screen), and "menu" (let the MenuStyle determine the
location).  The "menu" value is default (in the absense of the
function) so that the current behavior is maintained.

As a good fvwm-worker, I made changes to the sources as well as the
fvwm2 man page.  The feedback entry is excerpted below.

If this patch doesn't get into the official fvwm distribution, then at
least somebody should modify the man page for Move, Resize, and
MenuStyle indicating the current behavior and how it affects the
feedback window.

  FeedbackWindow location
       Specifies the location of the feedback window that fvwm2 displays dur-
       ing an interactive Resize or Move operation.  This window displays the
       current size during an interactive Resize operation, and the current
       location during an interactive Move opeartion.

       location may be "center" to have the feedback window appear at the
       center of the display, "topleft" to have the feedback window appear at
       the top left corner of the display, or "menu" to have the feedback
       window's location be determined by the current MenuStyle style parame-
       ter (centered for "mwm" style, otherwise topleft).  The location
       defaults to "menu" to provide compatibility with fvwm 2.0.x.

            FvwmWindow center
            FvwmWindow topleft
            FvwmWindow menu

-- 
Larry Gensch					      [email-masked]

               "May I have ten thousand marbles, please?"
Only in fvwm: Makefile
diff -r -u fvwm.old/functions.c fvwm/functions.c
--- fvwm.old/functions.c	Wed Dec  9 09:49:09 1998
+++ fvwm/functions.c	Wed Dec  9 09:53:04 1998
@@ -97,6 +97,7 @@
   {"EdgeScroll",   SetEdgeScroll,    F_EDGE_SCROLL,         FUNC_NO_WINDOW},
   {"Exec",         exec_function,    F_EXEC,                FUNC_NO_WINDOW},
   {"ExecUseSHELL", exec_setup,       F_EXEC_SETUP,          FUNC_NO_WINDOW},
+  {"FeedbackWindow", feedback_func,  F_FEEDBACK_WINDOW,     FUNC_NO_WINDOW},
   {"FlipFocus",    flip_focus_func,  F_FLIP_FOCUS,          FUNC_NEEDS_WINDOW},
   {"Focus",        focus_func,       F_FOCUS,               FUNC_NEEDS_WINDOW},
   {"Function",     ComplexFunction,  F_FUNCTION,            FUNC_NO_WINDOW},
diff -r -u fvwm.old/fvwm.c fvwm/fvwm.c
--- fvwm.old/fvwm.c	Wed Dec  9 09:49:09 1998
+++ fvwm/fvwm.c	Wed Dec  9 10:35:57 1998
@@ -42,6 +42,18 @@
 
 #define MAXHOSTNAME 255
 
+/*
+ * added 9-Dec-98 by lar3ry gensch -- allow direct specification of
+ * the location for the feedback window.  UNSET is default, to allow
+ * us to revert to the original behavior (set by MenuStyle).
+ */
+static enum {
+    FEEDBACK_UNSET,
+    FEEDBACK_CENTER,
+    FEEDBACK_TOPLEFT
+} feedback_opt = FEEDBACK_UNSET;
+
+Bool feedback_initialized = False;
 
 #ifndef lint
 static char sccsid[] = "@(#)fvwm.c " VERSION " " __DATE__ " fvwm";
@@ -432,7 +444,13 @@
   attributes.background_pixel = Scr.DefaultMenuFace->MenuColors.back;
   attributes.bit_gravity = NorthWestGravity;
   valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity);
-  if(Scr.DefaultMenuFace->style != MWMMenu)
+
+  /*
+   * modified 9-Dec-98 by lar3ry gensch -- allow direct specification
+   * of the location for the feedback window.
+   */
+  if((feedback_opt == FEEDBACK_UNSET && Scr.DefaultMenuFace->style != MWMMenu) ||
+     (feedback_opt == FEEDBACK_TOPLEFT))
   {
     Scr.SizeWindow = XCreateWindow (dpy, Scr.Root,
                                     0, 0,
@@ -463,6 +481,8 @@
                                     (Visual *) CopyFromParent,
                                     valuemask, &attributes);
   }
+  feedback_initialized = True;
+
 #ifndef NON_VIRTUAL
   initPanFrames();
 #endif
@@ -1559,3 +1579,45 @@
     BlackoutWin = None;
   }
 } /* UnBlackoutScreen */
+
+/*
+ * added 9-Dec-98 by lar3ry gensch -- allow direct specification of
+ * the location for the feedback window.
+ */
+void feedback_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                   unsigned long context,char *action, int *Module)
+{
+  char *arg = NULL;
+
+  action = GetNextToken(action,&arg);
+  if (arg != NULL) {
+    if (strcasecmp(arg, "center") == 0)
+      feedback_opt = FEEDBACK_CENTER;
+    else if (strcasecmp(arg, "topleft") == 0)
+      feedback_opt = FEEDBACK_TOPLEFT;
+    else if (strcasecmp(arg, "menu") == 0)
+      feedback_opt = FEEDBACK_UNSET;
+    else {
+      fvwm_msg(ERR, "FeedbackWindow",
+	       "Options are \"center,\" \"menu,\" or \"topleft.\"");
+      feedback_opt = FEEDBACK_UNSET;
+    }
+  } else {
+    fvwm_msg(ERR,"FedbackWindow","FedbackWindow requires 1 argument");
+    feedback_opt = FEEDBACK_UNSET;
+  }
+
+  if (feedback_initialized) {
+    if((feedback_opt == FEEDBACK_UNSET && Scr.DefaultMenuFace->style != MWMMenu) ||
+     (feedback_opt == FEEDBACK_TOPLEFT))
+    {
+      XMoveWindow(dpy, Scr.SizeWindow, 0, 0);
+    } else {
+      XMoveWindow(dpy, Scr.SizeWindow,
+		  Scr.MyDisplayWidth/2 -
+		    (Scr.SizeStringWidth + SIZE_HINDENT*2)/2,
+		  Scr.MyDisplayHeight/2 -
+		    (Scr.StdFont.height + SIZE_VINDENT*2)/2);
+    }
+  }
+} /* feedback_func */
diff -r -u fvwm.old/fvwm2.1 fvwm/fvwm2.1
--- fvwm.old/fvwm2.1	Wed Dec  9 09:49:09 1998
+++ fvwm/fvwm2.1	Wed Dec  9 10:45:12 1998
@@ -1216,6 +1216,28 @@
 .EE

+.IP "FeedbackWindow \fIlocation\fP"
+Specifies the location of the feedback window that fvwm2 displays
+during an interactive Resize or Move operation.
+This window displays the current size during an interactive Resize
+operation, and the current location during an interactive Move
+opeartion.
+
+\fIlocation\fP may be "center" to have the feedback window appear at
+the center of the display, "topleft" to have the feedback window
+appear at the top left corner of the display, or "menu" to have the
+feedback window's location be determined by the current
+MenuStyle \fIstyle\fP parameter (centered for "mwm" style, otherwise
+topleft).
+The \fIlocation\fP defaults to "menu" to provide compatibility with
+fvwm 2.0.x.
+.EX
+FvwmWindow center
+FvwmWindow topleft
+FvwmWindow menu
+.EE
+
+
 .IP "FlipFocus"
 Executes a \fIFocus\fP command as if the user had used the pointer to select
 the window.  This command alters the order of the windowlist in the same way
diff -r -u fvwm.old/misc.h fvwm/misc.h
--- fvwm.old/misc.h	Wed Dec  9 09:49:09 1998
+++ fvwm/misc.h	Wed Dec  9 09:54:15 1998
@@ -394,6 +394,8 @@
 		   unsigned long context, char *action, int *Module);
 void exec_setup(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                 unsigned long context, char *action, int *Module);
+void feedback_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                unsigned long context, char *action, int *Module);
 void refresh_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		      unsigned long context, char *action, int *Module);
 void refresh_win_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
diff -r -u fvwm.old/parse.h fvwm/parse.h
--- fvwm.old/parse.h	Wed Dec  9 09:49:09 1998
+++ fvwm/parse.h	Wed Dec  9 09:53:26 1998
@@ -116,6 +116,7 @@
     F_WINDOW_SHADE,
     F_COLOR_LIMIT,
     F_ANIMATED_MOVE,
+    F_FEEDBACK_WINDOW,
 
 /* Functions for use by modules only! */
     F_SEND_WINDOW_LIST = 1000

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 9 Dec 1998 19:56:03 +0100

> for "feedback" etc to no avail...  what caused this difference in

My, you've done quite a bit of work on that. It's so easy!
If you use fvwm menus you get it in the top left corner
and if you use mwm menus it's in the center of the screen.
This is a relict of the 'good old days' whene everything
was so uncomplicated ;-) The menu style is still used in
several non-menu-related parts of the code to determine
such behaviour.

We've had questions about this already (but asking how to
switch it off). Perhaps something should really be changed,
but probably not as a new command. I'd rather see this as
a global option (and call it 'MoveFeedback'). And it would
be definitely a good idea to have an option to switch it
off. Hold on for a moment, I think that should be discussed
on the list.

Bye

Dominik
-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dan Espen <[email-masked]>
Date: Wed, 09 Dec 1998 14:18:53 -0500

> off. Hold on for a moment, I think that should be discussed

We've had discussions before about  how  broken the MenuStyle  command
is.  I've  never liked the type (fvwm/mwm/win)  implying a whole bunch
of behaviors.   The     fact  that it controls   'MoveFeedBack'    and
'ResizeFeedBack' is even worse.

So I don't have a problem with some of the  behaviors being broken out
into separate commands.

Lets also discuss where this  patch goes.  I  don't see it in 2.2, its
just not necessary for stability.  I guess at some time soon we should
designate the main branch  for  further development and start  putting
2.2 stuff on a side branch?

--
Dan Espen                                Phone: (732) 699-5570
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked]
Date: Wed, 9 Dec 1998 14:40:41 -0500 (EST)

> several non-menu-related parts of the code to determine

Yup.  And it is definitely non-intuitive as it stands now.  A casual
comparison of .fvwm2rc files didn't show why the two systems were
getting differing behavior.

> off. Hold on for a moment, I think that should be discussed

You have a very good point.  Thinking about it, having it as its own
builtin function is a bit of overkill.

Obviously, my simple patch can be re-applied easily for GlobalOpts, so
we would use:

	GlobalOpts	FeedbackCenter/FeedbackTopLeft/FeedbackMenu

And while we are at it, it would also be simple to add:

	GlobalOpts	FeedbackOff

(for people that don't want the feedback window at all).  The "off"
value should just set Scr.SizeWindow = None.  I believe that the Move
and Resize code already don't use the window if it isn't set; if not,
it's another trivial fix.

Thinking about this a bit further, maybe GlobalOpts isn't really the
right place for this.

The Feedback window should really be described as part of fvwm2's
decors, and with it, we could/shout add the font, foreground and
background colors, etc.  This is a bit more coding (although it is
really straightforward, since it is obvious where these values are being
set in fvwm.c).

I don't know if we really want to add a new Decor parameter, and I
haven't really investigated this yet.  And, truthfully, I really
***HATE*** the current decor syntax... it's non-intuitive, misleading,
and baroque (to say the least... did I mention that I hate it???).

<SARCASM MODE=ON>
Until then, maybe it should be:

	DecorOpts	FeedbackPositionCenter...

And we can await the Great Decor Code Rewrite.
</SARCASM>

I look forward to hearing comments from others on the non-sarcastic
parts of this message on this list.

---

From: [email-masked]
Date: Wed, 9 Dec 1998 14:43:46 -0500 (EST)

> 2.2 stuff on a side branch?

OK... break it into two pieces...

1.  Move the code that explicitly describes the feedback window into
    the next development branch (2.3?).

2.  Modify the 2.1 / 2.2 man page so that the MenuStyle affecting things
    like the feedback window is at least DOCUMENTED.

---

From: [email-masked] (Paul D. Smith)
Date: 09 Dec 1998 15:22:03 -0500

%% [email-masked] writes:

  lg> 1.  Move the code that explicitly describes the feedback window
  lg> into the next development branch (2.3?).

Note that one of the first things on the plate for 2.3 is the GSFR.
That may allow us to break up _all_ the current menustyle stuff implied
by mwmmenus, etc. into separate items, then keep the current ones as
"aliases" for turning on bunches of behavior.

  lg> 2.  Modify the 2.1 / 2.2 man page so that the MenuStyle affecting things
  lg>     like the feedback window is at least DOCUMENTED.

Indeed.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].