FVWM: Replace function

From: Trent Piepho <xyzzy_at_u.washington.edu>
Date: Tue, 5 Nov 1996 21:03:03 -0800 (PST)

Well, I implimented a replace function. It was actually quite simple. What
is does is call CleverPlacement to find a new spot to stick a window. You
will need Anthony Martin's CleverPlacement replacement for placement.c. Some
suggested uses of it:

# have windows find a nice spot when they de-iconify
AddToFunc "Iconify-and-Replace" "C" Iconify
+ "C" Replace

Mouse 1 I A Function "Move-or-Iconify"
Mouse 2 I A Function "Iconify-and-Replace"
Mouse 3 I A Function "Iconify-and-Replace"

# double click on title bar replaces the window
AddToFunc "Move-or-Raise" "M" Move
+ "M" Raise
+ "C" Raise
+ "D" Replace
Mouse 1 T A Function "Move-or-Raise"


And finally the patch:
---------------------------- cut -------------------------
diff -u fvwm/builtins.c fvwm.new/builtins.c
--- fvwm/builtins.c Thu Jun 27 07:34:19 1996
+++ fvwm.new/builtins.c Mon Nov 4 08:39:22 1996
_at_@ -555,6 +555,21 @@
                y+val2*val2_unit/100 - warp_y);
 }
 
+void replace_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ unsigned long context,char *action, int *Module)
+{
+ int x,y;
+
+ if (DeferExecution(eventp,&w,&tmp_win,&context, SELECT,
+ ButtonRelease))
+ return;
+
+ CleverPlacement(tmp_win, &x, &y, 1);
+
+ SetupFrame(tmp_win,x,y,tmp_win->frame_width, tmp_win->frame_height,FALSE);
+
+ return;
+}
 
 void iconify_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                       unsigned long context,char *action, int *Module)
diff -u fvwm/functions.c fvwm.new/functions.c
--- fvwm/functions.c Wed Jun 19 17:01:56 1996
+++ fvwm.new/functions.c Mon Nov 4 08:24:34 1996
_at_@ -89,6 +89,7 @@
   {"Read", ReadFile, F_READ, FUNC_NO_WINDOW},
   {"Recapture", Recapture, F_RECAPTURE, FUNC_NO_WINDOW},
   {"Refresh", refresh_function, F_REFRESH, FUNC_NO_WINDOW},
+ {"Replace", replace_function, F_REPLACE, FUNC_NEEDS_WINDOW},
   {"Resize", resize_window, F_RESIZE, FUNC_NEEDS_WINDOW},
   {"Restart", restart_function, F_RESTART, FUNC_NO_WINDOW},
   {"KillModule", module_zapper, F_ZAP, FUNC_NO_WINDOW},
diff -u fvwm/misc.h fvwm.new/misc.h
--- fvwm/misc.h Wed Jun 19 18:31:15 1996
+++ fvwm.new/misc.h Mon Nov 4 08:28:02 1996
_at_@ -366,6 +366,8 @@
                 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 replace_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+ unsigned long context, char *action, int *Module);
 void stick_function(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                     unsigned long context, char *action, int *Module);
 
diff -u fvwm/parse.h fvwm.new/parse.h
--- fvwm/parse.h Thu May 30 11:03:10 1996
+++ fvwm.new/parse.h Mon Nov 4 08:25:14 1996
_at_@ -89,6 +89,7 @@
 #define F_SEND_STRING 112
 #define F_ADD_MOD 113
 #define F_DESTROY_MOD 114
+#define F_REPLACE 115
 
 /* Functions for use by modules only! */
 #define F_SEND_WINDOW_LIST 1000
------------------------------------------ cut --------------------

|Gazing up to the breeze of the heavens \ on a quest, meaning, reason |
|came to be, how it begun \ all alone in the family of the sun |
|curiosity teasing everyone \ on our home, third stone from the sun. |
|Trent Piepho (xyzzy_at_u.washington.edu) -- Metallica |
--
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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Nov 05 1996 - 23:03:10 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST