Subject: FVWM: feature patch: fixed icons

From: [email-masked] (Brian Gregory)
Date: Tue, 13 May 1997 15:41:22 -0700

Hi,

Summary: patches enclosed (one regular, one unified format) implement
the IconFix function, which makes an icon stick to its position as if
it was moved zero distance.  Man page updated, too.  Trivial changes
were required for the implementation.

----

I switched to fvwm about 6 months ago, and it's great.  The extensive
customization features sets it apart from most other window managers...

By way of background, once on the screen, I prefer things to stay put.
In fact, the main reason I went to fvwm is so that I can make moving and
resizing windows "much harder" from an interface standpoint (I have
move/raise and resize/raise do the move or resize function only when
control is pressed).  Similarly, I prefer the icon for a given program
to always appear in the same place.

Though the IconBox style is very useful, the box implements a
last-in, first-position placement scheme (yes, I could use an IconBox
per program, but I want groups of programs in the same box).  I
noticed that if an icon was moved, it stuck to the new position (in
the code, ICON_MOVED can be set but never unset, in fact).  After
a trivial modification, I introduced a new function called IconFix
which "moves" the icon zero distance once placed (by setting ICON_MOVED),
thus fixing the icon's position.

I implemented the interface much the same way the "Sticky" attribute
is implemented (Sticky was my implementation template -- valid??).
The way I use the IconFix function is this:

  bring up fvwm
  run all programs
  let fvwm position icons in the IconBox(es)
  shuffle icons if necessary (by ordering of opens and closes)
  run IconFix from each window's menu

One could also use icon geometries, but coverage across all apps is
varied, and plus, I really like the notion of IconBoxes, where "permanent"
windows have icons in known locations, while apps that come and go
are in the expected general area.  I also like the nice spacing that the
initial auto-placement offers.

Regular diff:
-------------------------------------------------------------------------------
diff -rc orig/builtins.c ./builtins.c
*** orig/builtins.c	Wed Jan 22 05:37:28 1997
--- ./builtins.c	Mon Apr 14 14:57:22 1997
***************
*** 950,955 ****
--- 950,976 ----
    SetTitleBar(tmp_win,(Scr.Hilite==tmp_win),True);
  }
  
+ 
+ void iconfix_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ 		      unsigned long context, char *action, int *Module)
+ {
+   if (DeferExecution(eventp,&w,&tmp_win,&context,SELECT,ButtonRelease))
+     return;
+ 
+   /* making the icon stick to its current location can be achieved
+    * by marking the icon moved. */
+   if(tmp_win->flags & ICON_MOVED)
+   {
+     tmp_win->flags &= ~ICON_MOVED;
+   }
+   else
+   {
+     tmp_win->flags |= ICON_MOVED;
+   }
+   BroadcastConfig(M_CONFIGURE_WINDOW,tmp_win);
+   SetTitleBar(tmp_win,(Scr.Hilite==tmp_win),True);
+ }
+ 
  void wait_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
  	       unsigned long context,char *action, int *Module)
  {
diff -rc orig/complex.c ./complex.c
*** orig/complex.c	Fri Apr 19 07:00:41 1996
--- ./complex.c	Mon Apr 14 14:59:49 1997
***************
*** 106,111 ****
--- 106,112 ----
     * F_RAISELOWER
     * F_MAXIMIZE
     * F_FOCUS
+    * F_ICONFIX
     *
     * These do not:
     * The function code is < 100
diff -rc orig/functions.c ./functions.c
*** orig/functions.c	Tue Jan 14 06:06:33 1997
--- ./functions.c	Mon Apr 14 15:01:02 1997
***************
*** 81,86 ****
--- 81,87 ----
    {"GotoPage",     goto_page_func,   F_GOTO_PAGE,           FUNC_NO_WINDOW},
    {"HilightColor", SetHiColor,       F_HICOLOR,             FUNC_NO_WINDOW},
    {"Iconify",      iconify_function, F_ICONIFY,             FUNC_NEEDS_WINDOW},
+   {"IconFix",      iconfix_function, F_ICONFIX,             FUNC_NEEDS_WINDOW},
    {"IconFont",     LoadIconFont,     F_ICONFONT,            FUNC_NO_WINDOW},
    {"IconPath",     setIconPath,      F_ICON_PATH,           FUNC_NO_WINDOW},
    {"Key",          ParseKeyEntry,    F_KEY,                 FUNC_NO_WINDOW},
diff -rc orig/fvwm2.man ./fvwm2.man
*** orig/fvwm2.man	Wed Jan 22 08:13:38 1997
--- ./fvwm2.man	Mon Apr 14 15:11:52 1997
***************
*** 1039,1044 ****
--- 1039,1048 ----
  positive the only iconification will be allowed.  It the optional
  argument is negative only de-iconification will be allowed.
  
+ .IP "IconFix"
+ Makes an icon more fixed in position if it is not already fixed,
+ or non-fixed if it is already fixed.
+ 
  
  .IP "IconPath \fIpath\fP"
  Specifies a colon separated list of full path names of directories
diff -rc orig/misc.h ./misc.h
*** orig/misc.h	Mon Dec 23 14:07:47 1996
--- ./misc.h	Mon Apr 14 15:01:22 1997
***************
*** 410,415 ****
--- 410,417 ----
  		      unsigned long context, char *action, int *Module);
  void stick_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
  		    unsigned long context, char *action, int *Module);
+ void iconfix_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ 		      unsigned long context, char *action, int *Module);
  
  void changeDesks_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
  		      unsigned long context,char *action, int *Module);
diff -rc orig/parse.h ./parse.h
*** orig/parse.h	Mon Dec 23 14:07:47 1996
--- ./parse.h	Mon Apr 14 15:00:25 1997
***************
*** 101,106 ****
--- 101,107 ----
  #define F_DESTROY_DECOR         124
  #define F_UPDATE_DECOR          125
  #define F_WINDOW_SHADE          126
+ #define F_ICONFIX               127
  
  /* Functions for use by modules only! */
  #define F_SEND_WINDOW_LIST     1000
-------------------------------------------------------------------------------

Unified diff:
-------------------------------------------------------------------------------
diff -ru orig/builtins.c ./builtins.c
--- orig/builtins.c	Wed Jan 22 05:37:28 1997
+++ ./builtins.c	Mon Apr 14 14:57:22 1997
@@ -950,6 +950,27 @@
   SetTitleBar(tmp_win,(Scr.Hilite==tmp_win),True);
 }
 
+
+void iconfix_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		      unsigned long context, char *action, int *Module)
+{
+  if (DeferExecution(eventp,&w,&tmp_win,&context,SELECT,ButtonRelease))
+    return;
+
+  /* making the icon stick to its current location can be achieved
+   * by marking the icon moved. */
+  if(tmp_win->flags & ICON_MOVED)
+  {
+    tmp_win->flags &= ~ICON_MOVED;
+  }
+  else
+  {
+    tmp_win->flags |= ICON_MOVED;
+  }
+  BroadcastConfig(M_CONFIGURE_WINDOW,tmp_win);
+  SetTitleBar(tmp_win,(Scr.Hilite==tmp_win),True);
+}
+
 void wait_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 	       unsigned long context,char *action, int *Module)
 {
diff -ru orig/complex.c ./complex.c
--- orig/complex.c	Fri Apr 19 07:00:41 1996
+++ ./complex.c	Mon Apr 14 14:59:49 1997
@@ -106,6 +106,7 @@
    * F_RAISELOWER
    * F_MAXIMIZE
    * F_FOCUS
+   * F_ICONFIX
    *
    * These do not:
    * The function code is < 100
diff -ru orig/functions.c ./functions.c
--- orig/functions.c	Tue Jan 14 06:06:33 1997
+++ ./functions.c	Mon Apr 14 15:01:02 1997
@@ -81,6 +81,7 @@
   {"GotoPage",     goto_page_func,   F_GOTO_PAGE,           FUNC_NO_WINDOW},
   {"HilightColor", SetHiColor,       F_HICOLOR,             FUNC_NO_WINDOW},
   {"Iconify",      iconify_function, F_ICONIFY,             FUNC_NEEDS_WINDOW},
+  {"IconFix",      iconfix_function, F_ICONFIX,             FUNC_NEEDS_WINDOW},
   {"IconFont",     LoadIconFont,     F_ICONFONT,            FUNC_NO_WINDOW},
   {"IconPath",     setIconPath,      F_ICON_PATH,           FUNC_NO_WINDOW},
   {"Key",          ParseKeyEntry,    F_KEY,                 FUNC_NO_WINDOW},
diff -ru orig/fvwm2.man ./fvwm2.man
--- orig/fvwm2.man	Wed Jan 22 08:13:38 1997
+++ ./fvwm2.man	Mon Apr 14 15:11:52 1997
@@ -1039,6 +1039,10 @@
 positive the only iconification will be allowed.  It the optional
 argument is negative only de-iconification will be allowed.
 
+.IP "IconFix"
+Makes an icon more fixed in position if it is not already fixed,
+or non-fixed if it is already fixed.
+
 
 .IP "IconPath \fIpath\fP"
 Specifies a colon separated list of full path names of directories
diff -ru orig/misc.h ./misc.h
--- orig/misc.h	Mon Dec 23 14:07:47 1996
+++ ./misc.h	Mon Apr 14 15:01:22 1997
@@ -410,6 +410,8 @@
 		      unsigned long context, char *action, int *Module);
 void stick_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		    unsigned long context, char *action, int *Module);
+void iconfix_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		      unsigned long context, char *action, int *Module);
 
 void changeDesks_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		      unsigned long context,char *action, int *Module);
diff -ru orig/parse.h ./parse.h
--- orig/parse.h	Mon Dec 23 14:07:47 1996
+++ ./parse.h	Mon Apr 14 15:00:25 1997
@@ -101,6 +101,7 @@
 #define F_DESTROY_DECOR         124
 #define F_UPDATE_DECOR          125
 #define F_WINDOW_SHADE          126
+#define F_ICONFIX               127
 
 /* Functions for use by modules only! */
 #define F_SEND_WINDOW_LIST     1000
-------------------------------------------------------------------------------
Brian Gregory  [email-masked]                   |           |
Phone : (805) 961-3622                             |||         |||
Fax   : (805) 961-3600                            |||||       |||||
150 Castilian Drive                           ..:|||||||:...:|||||||:..
Santa Barbara, CA 93117 (U.S.A.)              c i s c o   S y s t e m s
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked] (Brian Gregory)
Date: Tue, 13 May 1997 16:10:08 -0700

I forgot to mention that the patches are on 2.0.45.
Brian