about summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authoroga <oga>2008-06-25 22:37:29 +0000
committeroga <oga>2008-06-25 22:37:29 +0000
commit2dfd021f8bd4298624d10b18969e52032a198a6a (patch)
treebd39aa0bdcf25d0953323f32cf1cdda117fd7bb5 /conf.c
parent77058c59e296434dc2ba1f39e27f64630b12f656 (diff)
downloadcwm-2dfd021f8bd4298624d10b18969e52032a198a6a.tar.gz
cwm-2dfd021f8bd4298624d10b18969e52032a198a6a.tar.xz
cwm-2dfd021f8bd4298624d10b18969e52032a198a6a.zip
Actually grab the correct mouse buttons for a window, instead of doing the
old hardcoded ones (which now can be wrong).

tested by todd@ and johan@.
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/conf.c b/conf.c
index 1767d14..1972287 100644
--- a/conf.c
+++ b/conf.c
@@ -474,3 +474,33 @@ conf_mouseunbind(struct conf *c, struct mousebinding *unbind)
 	}
 }
 
+/*
+ * Grab the mouse buttons that we need for bindings for this client
+ */
+void
+conf_grab_mouse(struct client_ctx *cc)
+{
+	struct mousebinding	*mb;
+	int			 button;
+	
+
+	TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
+		if (mb->context != MOUSEBIND_CTX_WIN)
+ 			continue;
+
+		switch(mb->button) {
+		case 1:
+			button = Button1;
+			break;
+		case 2:
+			button = Button2;
+			break;
+		case 3:
+			button = Button3;
+			break;
+		default:
+			warnx("strange button in mousebinding\n");
+		}
+		xu_btn_grab(cc->pwin, mb->modmask, button);
+	}
+}