Subject: IconForgetLocation patch

From: Jim Zelenka <[email-masked]>
Date: Fri, 29 Sep 2000 12:14:16 -0400

I've recently switched window managers to fvwm2- I used the
2.2.4 stable release from www.fvwm2.org. Before switching, I
was a long-time uwm user (uwm is a *very* old window manager).

One thing I became very used to with uwm was the way that
icons could be created and dragged around on-the-fly. By
default, fvwm2 seemed to have the characteristic that if I bound:

         Mouse 1 I N Iconify -1

in my .fvwm2rc, the first time I iconified a window, I could drag
the icon into place while holding down the mouse button. If
I deiconified the window and attempted to re-iconify it, it would
immediately iconify in the previous icon location. To work around this,
I added an option to fvwm2: "IconForgetLocation". When enabled,
each time Iconify() operates, it re-gets the window's location, and
starts the icon there- just like uwm did :-).

I believe I followed the instructions in the FAQ for submiting a
patch- my apologies if I made any mistakes. Obviously, I'd love it
if this could be incorporated in future releases so I don't have to
maintain it myself. Please let me know if I've made any mistakes,
or if there's any additional material I can provide. In the FAQ,
it says "Be sure to read the answer to Q16" in 5.2 ("How do I
create/submit/apply patches?"). I could not figure out to what that
referred, so my apologies if I've missed something.

I made all my changes #ifdef JIMZ, and added -DJIMZ to Makefile.{am,in}
in my tree. I hope this doesn't cause any problems or confusion.

Here are the diffs:

helprin% diff -u ChangeLog.orig ChangeLog
--- ChangeLog.orig      Mon Nov 29 04:16:57 1999
+++ ChangeLog   Fri Sep 29 12:02:44 2000
@@ -1,3 +1,16 @@
+2000-09-29  Jim Zelenka  <[email-masked]>
+
+       * fvwm/icons.c:  add support for IconForgetLocation
+       IconForgetLocation is a .fvwm2rc parameter which, when set,
+       causes windows to forget where they were previously iconified
+       each time they are iconified. This allows emulation of
+       uwm-style icon manipulation (minus the editing features)
+       * fvwm/screen.h:  add support for IconForgetLocation
+       * fvwm/parse.h:  add support for IconForgetLocation
+       * fvwm/misc.h:  add support for IconForgetLocation
+       * fvwm/functions.c: add support for IconForgetLocation
+       * fvwm/builtins.c: add support for IconForgetLocation
+
 1999-10-19  Dominik Vogt  <[email-masked]>
 
        * configure.in: set version to 2.2.3.

helprin% diff -u builtins.c.orig builtins.c
--- builtins.c.orig     Wed Sep 29 12:33:33 1999
+++ builtins.c  Fri Sep 29 11:02:32 2000
@@ -1201,6 +1201,22 @@
   Scr.MoveResistance = val[1];
 }
 
+#ifdef JIMZ
+void setIconForgetLocation(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                       unsigned long context, char *action,int* Module)
+{
+  int val[1];
+
+  if (GetIntegerArguments(action, NULL, val, 1) != 1)
+  {
+    fvwm_msg(ERR,"setIconForgetLocation","IconForgetLocation requires one argument");
+    return;
+  }
+
+  Scr.iconForgetLocation = val[0];
+}
+#endif /* JIMZ */
+
 void SetColormapFocus(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                       unsigned long context, char *action,int* Module)
 {

helprin% diff -u functions.c.orig functions.c
--- functions.c.orig    Sat Oct  2 19:28:37 1999
+++ functions.c Fri Sep 29 11:03:09 2000
@@ -115,6 +115,9 @@
   {"GotoPage",     goto_page_func,   F_GOTO_PAGE,           FUNC_NO_WINDOW},
   {"HilightColor", SetHiColor,       F_HICOLOR,             FUNC_NO_WINDOW},
   {"IconFont",     LoadIconFont,     F_ICONFONT,            FUNC_NO_WINDOW},
+#ifdef JIMZ
+  {"IconForgetLocation",       setIconForgetLocation,  F_FORGET_ICON_LOC,      FUNC_NO_WINDOW},
+#endif /* JIMZ */
   {"Iconify",      iconify_function, F_ICONIFY,             FUNC_NEEDS_WINDOW},
   {"IconPath",     setIconPath,      F_ICON_PATH,           FUNC_NO_WINDOW},
   {"ImagePath",    setImagePath,     F_ICON_PATH,           FUNC_NO_WINDOW},

helprin% diff -u icons.c.orig icons.c
--- icons.c.orig        Wed Jan 13 20:42:52 1999
+++ icons.c     Fri Sep 29 11:06:13 2000
@@ -948,6 +948,36 @@
     else
        CreateIconWindow(tmp_win, def_x, def_y);
   }
+#ifdef JIMZ
+  else {
+    if (Scr.iconForgetLocation) {
+      XWindowChanges xwc;
+      unsigned long xwcm;
+      tmp_win->icon_xl_loc = def_x;
+      tmp_win->icon_x_loc = def_x;
+      tmp_win->icon_y_loc = def_y;
+      if (!(tmp_win->flags&ICON_UNMAPPED)) {
+        BroadcastPacket(M_ICON_LOCATION,7,
+          tmp_win->w,tmp_win->frame,
+          (unsigned long)tmp_win, tmp_win->icon_x_loc, tmp_win->icon_y_loc,
+          tmp_win->icon_w_width,
+          tmp_win->icon_w_height + tmp_win->icon_p_height);
+      }
+      xwcm = CWX|CWY;
+      xwc.x = def_x;
+      xwc.y = def_y;
+      XConfigureWindow(dpy, tmp_win->icon_w, xwcm, &xwc);
+      xwc.x = tmp_win->icon_x_loc;
+      xwc.y = tmp_win->icon_y_loc;
+      if (tmp_win->icon_pixmap_w != None)
+        XConfigureWindow(dpy, tmp_win->icon_pixmap_w, xwcm, &xwc);
+      xwc.x = tmp_win->icon_x_loc;
+      xwc.y = tmp_win->icon_y_loc;
+      if (tmp_win->icon_w != None)
+        XConfigureWindow(dpy, tmp_win->icon_w, xwcm, &xwc);
+    }
+  }
+#endif /* JIMZ */
 
   /* if no pixmap we want icon width to change to text width every iconify */
   if( (tmp_win->icon_w != None) && (tmp_win->icon_pixmap_w == None) ) {

helprin% diff -u misc.h.orig misc.h
--- misc.h.orig Sun Feb 14 10:48:56 1999
+++ misc.h      Fri Sep 29 11:07:08 2000
@@ -342,6 +342,12 @@
 void SetColormapFocus(F_CMD_ARGS);
 void SetColorLimit(F_CMD_ARGS);
 
+#ifdef JIMZ
+void setIconForgetLocation(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                    unsigned long context, char *action,int *Module);
+#endif /* JIMZ */
+
+
 #define UP 1
 #define DOWN 0
 void MapIt(FvwmWindow *t);

helprin% diff -u parse.h.orig parse.h
--- parse.h.orig        Tue Jan 12 16:07:44 1999
+++ parse.h     Fri Sep 29 11:07:28 2000
@@ -116,6 +116,9 @@
     F_WINDOW_SHADE,
     F_COLOR_LIMIT,
     F_ANIMATED_MOVE,
+#ifdef JIMZ
+       F_FORGET_ICON_LOC,
+#endif /* JIMZ */
 
     F_END_OF_LIST = 999,

helprin% diff -u screen.h.orig screen.h
--- screen.h.orig       Fri Sep 29 11:08:27 2000
+++ screen.h    Fri Sep 29 11:08:41 2000
@@ -312,6 +312,9 @@
   int CurrentDesk;             /* The current desktop number */
   int ColormapFocus;           /* colormap focus style */
   int ColorLimit;              /* Limit on colors used in pixmaps */
+#ifdef JIMZ
+  int iconForgetLocation;      /* don't cache previous icon locations */
+#endif /* JIMZ */
 
   /*
   ** some additional global options which will probably become window
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Fri, 29 Sep 2000 14:25:32 -0400

> referred, so my apologies if I've missed something.

It looks like you were reading the FAQ that comes with 2.2.4.

The current FAQ is at http://www.fvwm.org.

In the current FAQ, the reference to Q16 was corrected to point to
point to 5.1.  (Wait, it gets worse.)

The answer to Question 5.1 includes this:

If you plan to write a patch, *please*, first of all fetch the
   latest development release from our web site.

There's more,  I suggest reading it.

> in my tree. I hope this doesn't cause any problems or confusion.

If-defing the patch isn't necessary.

I can't comment on whether the patch would be accepted.
I would guess we'd rather apply this as a "Style".

The other issue is that we are in hard freeze, since  we are trying to
release another non-beta.  (I think we  are close.) I don't think that
should deter   you  though.   The  icon  movement behavior  comes   up
periodically and some flexibility there is probably a good idea.

--
Dan Espen
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854                     Phone: (732) 699-5570
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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]