Subject: FVWM: FlipFocus patch

From: Dan Niles <[email-masked]>
Date: Mon, 29 Apr 1996 17:19:42 -0500

FlipFocus is done.  The patch (68 lines) is at the end of this note.

To try out FlipFocus, I recommend something like:

Key F8	A	N	Prev [CurrentScreen] FlipFocus
Key F8	A	S	Prev [CurrentScreen] Focus

Send me, or this group, some email to say how you like it.

With no further delay, here it is.

Dan Niles
[email-masked]

--------------------- fvwm-2.0.42-FlipFocus.patch ----------------------------
--- parse.h.orig	Thu Mar 28 09:24:48 1996
+++ parse.h	Mon Apr 29 17:03:13 1996
@@ -85,6 +85,7 @@
 #define F_RAISELOWER            108
 #define F_MAXIMIZE              109
 #define F_FOCUS                 110
+#define F_FLIP_FOCUS            111
 
 /* Functions for use by modules only! */
 #define F_SEND_WINDOW_LIST     1000
--- misc.h.orig	Thu Apr  4 17:47:30 1996
+++ misc.h	Mon Apr 29 17:03:46 1996
@@ -381,6 +381,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 SendDataToModule(XEvent *eventp,Window w,FvwmWindow *tmp_win,
--- functions.c.orig	Thu Mar 28 09:24:23 1996
+++ functions.c	Mon Apr 29 17:03:22 1996
@@ -53,6 +53,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	Wed Apr 10 12:38:25 1996
+++ builtins.c	Mon Apr 29 17:03:33 1996
@@ -757,6 +757,33 @@
 }

+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;
+
+  if( Scr.Focus == NULL || tmp_win == Scr.Focus ){
+    /* There is no window with focus */
+    FocusOn(tmp_win,0);
+    return;
+  }
+
+  scratch=Scr.Focus->next;
+  if( (Scr.Focus->next=tmp_win->next) ) Scr.Focus->next->prev=Scr.Focus;
+  if( (tmp_win->next=scratch) ) tmp_win->next->prev=tmp_win;
+  scratch=Scr.Focus->prev;
+  if( (Scr.Focus->prev=tmp_win->prev) ) Scr.Focus->prev->next=Scr.Focus;
+  if( (tmp_win->prev=scratch) ) tmp_win->prev->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].