Subject: ignoring mouse bindings

From: [email-masked]
Date: Sat, 24 Jan 2004 05:37:15 +0000 (GMT)

Greetings,

I have hacked the current (2.5.8) version of fvwm to include a new
window style flag called "IgnoreMouseBindings", which causes all
button presses in the corresponding window context to be passed
through to the application, even if otherwise bound.  This is useful
for vnc viewer style applications, where there's another wm running
inside the application window.  With reasonable bindings one can still
manipulate the container (vncviewer) window through its border context
bindings or menus.

Would it be useful if I posted a patch (it's pretty trivial) to this
list, or is this too arcane a feature for the main branch?  If a
patch, is making it against 2.5.8 ok, or would you rather I grabbed
the current cvs?

m.
-- 
Maneesh Sahani
University of California, San Francisco		[email-masked]
513 Parnassus Ave, Box 0732,			tel: +1 415 502 4876
San Francisco, CA 94143-0732 			fax: +1 415 502 4848

--
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: "S. Anderson" <[email-masked]>
Date: Mon, 26 Jan 2004 18:01:44 -0700

> patch, is making it against 2.5.8 ok, or would you rather I grabbed

Your patch sounds interesting. You should post it.

---

From: Maneesh Sahani <[email-masked]>
Date: Tue, 27 Jan 2004 03:02:08 +0000 (GMT)

> Your patch sounds interesting. You should post it.

Here you go.  diff -ur applied to at the root of the 2.5.8 tree.
Fortuitously, the first hunk covers the only operative change ... the
rest is just the bookkeeping needed to set up the style flag.

m.

diff -ur fvwm-2.5.8-orig/fvwm/events.c fvwm-2.5.8-mod/fvwm/events.c
--- fvwm-2.5.8-orig/fvwm/events.c	2003-08-28 13:26:14.000000000 -0700
+++ fvwm-2.5.8-mod/fvwm/events.c	2004-01-26 17:15:04.000000000 -0800
@@ -1388,6 +1388,14 @@
 		PressedW = None;
 		return False;
 	}
+	/* IgnoreMouseBindings code */
+	if (DO_IGNORE_MOUSE_BINDINGS(exc->w.fw) && exc->w.wcontext == C_WINDOW)
+	{
+		PressedW = None;
+		return False;
+	}
+	/* end IgnoreMouseBindings */
+	  
 	/* draw pressed in decorations */
 	part = border_context_to_parts(exc->w.wcontext);
 	do_force = (part & PART_TITLEBAR) ? True : False;
diff -ur fvwm-2.5.8-orig/fvwm/fvwm.h fvwm-2.5.8-mod/fvwm/fvwm.h
--- fvwm-2.5.8-orig/fvwm/fvwm.h	2003-09-24 02:15:20.000000000 -0700
+++ fvwm-2.5.8-mod/fvwm/fvwm.h	2004-01-26 17:15:25.000000000 -0800
@@ -219,6 +219,9 @@
 		unsigned do_ewmh_use_stacking_hints : 1;
 		unsigned do_iconify_window_groups : 1;
 		unsigned do_ignore_gnome_hints : 1;
+	  /* IgnoreMouseBindings code */
+	        unsigned do_ignore_mouse_bindings : 1;
+	  /* end IgnoreMouseBindings */
 		unsigned do_ignore_icon_boxes : 1;
 		unsigned do_ignore_restack : 1;
 		unsigned do_use_window_group_hint : 1;
diff -ur fvwm-2.5.8-orig/fvwm/style.c fvwm-2.5.8-mod/fvwm/style.c
--- fvwm-2.5.8-orig/fvwm/style.c	2003-08-22 21:27:43.000000000 -0700
+++ fvwm-2.5.8-mod/fvwm/style.c	2004-01-26 17:16:34.000000000 -0800
@@ -2794,6 +2794,16 @@
 			S_SET_IS_UNICONIFIABLE(SCM(*ps), 1);
 			S_SET_IS_UNICONIFIABLE(SCC(*ps), 1);
 		}
+		/* IgnoreMouseBindings code */
+		else if (StrEquals(token, "IgnoreMouseBindings"))
+		{
+		  fprintf(stderr, "ignoring mouse bindings: %s", 
+			  SGET_ICON_NAME(*ps));
+		        S_SET_DO_IGNORE_MOUSE_BINDINGS(SCF(*ps), on);
+		        S_SET_DO_IGNORE_MOUSE_BINDINGS(SCM(*ps), 1);
+		        S_SET_DO_IGNORE_MOUSE_BINDINGS(SCC(*ps), 1);
+		}
+		/* end IgnoreMouseBindings */
 		else if (StrEquals(token, "IndexedWindowName"))
 		{
 			S_SET_USE_INDEXED_WINDOW_NAME(SCF(*ps), on);
diff -ur fvwm-2.5.8-orig/fvwm/style.h fvwm-2.5.8-mod/fvwm/style.h
--- fvwm-2.5.8-orig/fvwm/style.h	2003-07-16 02:10:40.000000000 -0700
+++ fvwm-2.5.8-mod/fvwm/style.h	2004-01-26 17:17:09.000000000 -0800
@@ -163,6 +163,12 @@
 	((c).s.do_ignore_restack)
 #define S_SET_DO_IGNORE_RESTACK(c,x) \
 	((c).s.do_ignore_restack = !!(x))
+/* IgnoreMouseBindings code */
+#define S_DO_IGNORE_MOUSE_BINDINGS(c) \
+	((c).s.do_ignore_mouse_bindings)
+#define S_SET_DO_IGNORE_MOUSE_BINDINGS(c,x) \
+	((c).s.do_ignore_mouse_bindings = !!(x))
+/* end IgnoreMouseBindings */
 #define S_DO_USE_WINDOW_GROUP_HINT(c) \
 	((c).s.do_use_window_group_hint)
 #define S_SET_DO_USE_WINDOW_GROUP_HINT(c,x) \
diff -ur fvwm-2.5.8-orig/fvwm/window_flags.h fvwm-2.5.8-mod/fvwm/window_flags.h
--- fvwm-2.5.8-orig/fvwm/window_flags.h	2003-08-14 01:48:20.000000000 -0700
+++ fvwm-2.5.8-mod/fvwm/window_flags.h	2004-01-26 17:17:36.000000000 -0800
@@ -207,6 +207,10 @@
 	((fw)->flags.common.s.do_ignore_restack)
 #define DO_IGNORE_ICON_BOXES(fw) \
 	((fw)->flags.common.s.do_ignore_icon_boxes)
+/* IgnoreMouseBindings code */
+#define DO_IGNORE_MOUSE_BINDINGS(fw) \
+	((fw)->flags.common.s.do_ignore_mouse_bindings)
+/* end IgnoreMouseBindings */
 #define DO_USE_WINDOW_GROUP_HINT(fw) \
 	((fw)->flags.common.s.do_use_window_group_hint)
 #define IS_FIXED(fw) \