Subject: FVWM: FlipFocus patch for 2.0.43

From: Dan Niles <[email-masked]>
Date: Wed, 10 Jul 1996 07:54:05 -0500

Here is an my FlipFocus patch updated for fvwm 2.0.43.  For those of
of you who are new, FlipFocus swaps the top two (selected) windows.
This lets you switch back and forth between frequently used windows without
having to remember if you need to use Prev or Next.

The arguments to FlipFocus are the same as to Focus.

------------------------ fvwm-2.0.43-FlipFocus.patch -------------------------
--- parse.h.orig	Thu May 30 13:03:10 1996
+++ parse.h	Tue Jul  9 11:25:10 1996
@@ -89,6 +89,7 @@
 #define F_SEND_STRING           112
 #define F_ADD_MOD               113
 #define F_DESTROY_MOD           114
+#define F_FLIP_FOCUS            115
 
 /* Functions for use by modules only! */
 #define F_SEND_WINDOW_LIST     1000
--- misc.h.orig	Wed Jun 19 20:31:15 1996
+++ misc.h	Tue Jul  9 11:16:15 1996
@@ -384,6 +384,8 @@
 	       unsigned long context,char *action, int *Module);
 void raise_it_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		   unsigned long context, char *action, int *Module);
+void flip_focus_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		unsigned long context, char *action, int *Module);
 void focus_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		unsigned long context, char *action, int *Module);
 void warp_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
--- functions.c.orig	Wed Jun 19 19:01:56 1996
+++ functions.c	Tue Jul  9 11:16:15 1996
@@ -55,6 +55,7 @@
   {"EdgeResistance",SetEdgeResistance,F_EDGE_RES,           FUNC_NO_WINDOW},
   {"Exec",         exec_function,    F_EXEC,                FUNC_NO_WINDOW},
   {"ExecUseSHELL", exec_setup,       F_EXEC_SETUP,          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},
   {"GotoPage",     goto_page_func,   F_GOTO_PAGE,           FUNC_NO_WINDOW},
--- builtins.c.orig	Thu Jun 27 09:34:19 1996
+++ builtins.c	Tue Jul  9 11:16:15 1996
@@ -847,6 +847,38 @@
 }

+void flip_focus_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		unsigned long context, char *action, int *Module)
+{
+
+  FvwmWindow *scratch;
+
+  if (DeferExecution(eventp,&w,&tmp_win,&context,SELECT,ButtonRelease))
+    return;
+
+  /* Reorder the window list */
+  if( Scr.Focus ){
+    if( Scr.Focus->next ) Scr.Focus->next->prev = Scr.Focus->prev;
+    if( Scr.Focus->prev ) Scr.Focus->prev->next = Scr.Focus->next;
+    Scr.Focus->next = Scr.FvwmRoot.next;
+    Scr.Focus->prev = &Scr.FvwmRoot;
+    if(Scr.FvwmRoot.next)Scr.FvwmRoot.next->prev = Scr.Focus;
+    Scr.FvwmRoot.next = Scr.Focus;
+  }
+  if( tmp_win != Scr.Focus ){
+    if( tmp_win->next ) tmp_win->next->prev = tmp_win->prev;
+    if( tmp_win->prev ) tmp_win->prev->next = tmp_win->next;
+    tmp_win->next = Scr.FvwmRoot.next;
+    tmp_win->prev = &Scr.FvwmRoot;
+    if(Scr.FvwmRoot.next)Scr.FvwmRoot.next->prev = tmp_win;
+    Scr.FvwmRoot.next = tmp_win;
+  }
+
+  FocusOn(tmp_win,0);
+
+}
+
+
 void focus_func(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		unsigned long context, char *action, int *Module)
 {
--
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: "Charles Hines" <[email-masked]>
Date: Wed, 10 Jul 1996 09:31:28 -0400

>>>>> "Dan" == Dan Niles <[email-masked]> writes:

Dan> Here is an my FlipFocus patch updated for fvwm 2.0.43.  For those
Dan> of of you who are new, FlipFocus swaps the top two (selected)
Dan> windows.  This lets you switch back and forth between frequently
Dan> used windows without having to remember if you need to use Prev
Dan> or Next.

Most likely this will make it into 2.1.0.  Although I didn't want to
put anything new in there, this is pretty harmless so I'll probably
put it in.

Chuck