about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-07-01 19:26:17 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-07-01 19:26:17 +0100
commit9bb0f20515023aa5471c628d01a6e65e93040dc1 (patch)
tree0ee468f33468739f035c44a9cd374a0bfd6a34cc /dwm.c
parent2431ae7df7f654f6dbe5e923fadf703eaa4a7bf4 (diff)
downloaddwm-9bb0f20515023aa5471c628d01a6e65e93040dc1.tar.gz
applied Frederik Ternerot's grabbuttons patch with slight modifications
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index 0691029..e135715 100644
--- a/dwm.c
+++ b/dwm.c
@@ -723,19 +723,18 @@ gettextprop(Window w, Atom atom, char *text, uint size) {
 
 void
 grabbuttons(Client *c, Bool focused) {
-	int i, j;
-	uint buttons[]   = { Button1, Button2, Button3 };
-	uint modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask, MODKEY|numlockmask|LockMask };
+	uint i, j;
+	uint modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
 
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
-	if(focused)
+	if(focused) {
 		for(i = 0; i < LENGTH(buttons); i++)
-			for(j = 0; j < LENGTH(modifiers); j++)
-				XGrabButton(dpy, buttons[i], modifiers[j], c->win, False,
-					BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
-	else
+			if(buttons[i].click == ClkClientWin)
+				for(j = 0; j < LENGTH(modifiers); j++)
+					XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+        } else
 		XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
-			BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
+		            BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
 }
 
 void