dwm-meillo
diff client.c @ 318:1b45d6f14fca
applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
author | Anselm R.Garbe <arg@10ksloc.org> |
---|---|
date | Mon, 21 Aug 2006 09:03:14 +0200 |
parents | d9bef4067cd5 |
children | 94d2d7658673 |
line diff
1.1 --- a/client.c Mon Aug 21 07:33:18 2006 +0200 1.2 +++ b/client.c Mon Aug 21 09:03:14 2006 +0200 1.3 @@ -11,6 +11,19 @@ 1.4 /* static functions */ 1.5 1.6 static void 1.7 +grabbutton(Client *c, unsigned int button, unsigned int modifier) 1.8 +{ 1.9 + XGrabButton(dpy, button, modifier, c->win, False, BUTTONMASK, 1.10 + GrabModeAsync, GrabModeSync, None, None); 1.11 + XGrabButton(dpy, button, modifier | LockMask, c->win, False, BUTTONMASK, 1.12 + GrabModeAsync, GrabModeSync, None, None); 1.13 + XGrabButton(dpy, button, modifier | numlockmask, c->win, False, BUTTONMASK, 1.14 + GrabModeAsync, GrabModeSync, None, None); 1.15 + XGrabButton(dpy, button, modifier | numlockmask | LockMask, c->win, False, BUTTONMASK, 1.16 + GrabModeAsync, GrabModeSync, None, None); 1.17 +} 1.18 + 1.19 +static void 1.20 resizetitle(Client *c) 1.21 { 1.22 int i; 1.23 @@ -31,6 +44,15 @@ 1.24 1.25 } 1.26 1.27 +static void 1.28 +ungrabbutton(Client *c, unsigned int button, unsigned int modifier) 1.29 +{ 1.30 + XUngrabButton(dpy, button, modifier, c->win); 1.31 + XUngrabButton(dpy, button, modifier | LockMask, c->win); 1.32 + XUngrabButton(dpy, button, modifier | numlockmask, c->win); 1.33 + XUngrabButton(dpy, button, modifier | numlockmask | LockMask, c->win); 1.34 +} 1.35 + 1.36 static int 1.37 xerrordummy(Display *dsply, XErrorEvent *ee) 1.38 { 1.39 @@ -53,11 +75,14 @@ 1.40 1.41 if (!issel) 1.42 return; 1.43 - if(sel && sel->ismax) 1.44 + if(sel && sel->ismax && sel != c) 1.45 togglemax(NULL); 1.46 sel = c; 1.47 - if(old && old != c) 1.48 + if(old && old != c) { 1.49 + grabbutton(old, AnyButton, 0); 1.50 drawtitle(old); 1.51 + } 1.52 + ungrabbutton(c, AnyButton, 0); 1.53 drawtitle(c); 1.54 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 1.55 } 1.56 @@ -230,32 +255,9 @@ 1.57 c->next = clients; 1.58 clients = c; 1.59 1.60 - XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, 1.61 - GrabModeAsync, GrabModeSync, None, None); 1.62 - XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, 1.63 - GrabModeAsync, GrabModeSync, None, None); 1.64 - XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK, 1.65 - GrabModeAsync, GrabModeSync, None, None); 1.66 - XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, 1.67 - GrabModeAsync, GrabModeSync, None, None); 1.68 - 1.69 - XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK, 1.70 - GrabModeAsync, GrabModeSync, None, None); 1.71 - XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK, 1.72 - GrabModeAsync, GrabModeSync, None, None); 1.73 - XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK, 1.74 - GrabModeAsync, GrabModeSync, None, None); 1.75 - XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, 1.76 - GrabModeAsync, GrabModeSync, None, None); 1.77 - 1.78 - XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, 1.79 - GrabModeAsync, GrabModeSync, None, None); 1.80 - XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK, 1.81 - GrabModeAsync, GrabModeSync, None, None); 1.82 - XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK, 1.83 - GrabModeAsync, GrabModeSync, None, None); 1.84 - XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, 1.85 - GrabModeAsync, GrabModeSync, None, None); 1.86 + grabbutton(c, Button1, MODKEY); 1.87 + grabbutton(c, Button2, MODKEY); 1.88 + grabbutton(c, Button3, MODKEY); 1.89 1.90 settags(c); 1.91 if(!c->isfloat)