Mercurial > aewl
comparison 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 |
comparison
equal
deleted
inserted
replaced
317:45af6a8a0cbf | 318:1b45d6f14fca |
---|---|
7 #include <string.h> | 7 #include <string.h> |
8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
10 | 10 |
11 /* static functions */ | 11 /* static functions */ |
12 | |
13 static void | |
14 grabbutton(Client *c, unsigned int button, unsigned int modifier) | |
15 { | |
16 XGrabButton(dpy, button, modifier, c->win, False, BUTTONMASK, | |
17 GrabModeAsync, GrabModeSync, None, None); | |
18 XGrabButton(dpy, button, modifier | LockMask, c->win, False, BUTTONMASK, | |
19 GrabModeAsync, GrabModeSync, None, None); | |
20 XGrabButton(dpy, button, modifier | numlockmask, c->win, False, BUTTONMASK, | |
21 GrabModeAsync, GrabModeSync, None, None); | |
22 XGrabButton(dpy, button, modifier | numlockmask | LockMask, c->win, False, BUTTONMASK, | |
23 GrabModeAsync, GrabModeSync, None, None); | |
24 } | |
12 | 25 |
13 static void | 26 static void |
14 resizetitle(Client *c) | 27 resizetitle(Client *c) |
15 { | 28 { |
16 int i; | 29 int i; |
29 else | 42 else |
30 XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th); | 43 XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th); |
31 | 44 |
32 } | 45 } |
33 | 46 |
47 static void | |
48 ungrabbutton(Client *c, unsigned int button, unsigned int modifier) | |
49 { | |
50 XUngrabButton(dpy, button, modifier, c->win); | |
51 XUngrabButton(dpy, button, modifier | LockMask, c->win); | |
52 XUngrabButton(dpy, button, modifier | numlockmask, c->win); | |
53 XUngrabButton(dpy, button, modifier | numlockmask | LockMask, c->win); | |
54 } | |
55 | |
34 static int | 56 static int |
35 xerrordummy(Display *dsply, XErrorEvent *ee) | 57 xerrordummy(Display *dsply, XErrorEvent *ee) |
36 { | 58 { |
37 return 0; | 59 return 0; |
38 } | 60 } |
51 { | 73 { |
52 Client *old = sel; | 74 Client *old = sel; |
53 | 75 |
54 if (!issel) | 76 if (!issel) |
55 return; | 77 return; |
56 if(sel && sel->ismax) | 78 if(sel && sel->ismax && sel != c) |
57 togglemax(NULL); | 79 togglemax(NULL); |
58 sel = c; | 80 sel = c; |
59 if(old && old != c) | 81 if(old && old != c) { |
82 grabbutton(old, AnyButton, 0); | |
60 drawtitle(old); | 83 drawtitle(old); |
84 } | |
85 ungrabbutton(c, AnyButton, 0); | |
61 drawtitle(c); | 86 drawtitle(c); |
62 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); | 87 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
63 } | 88 } |
64 | 89 |
65 void | 90 void |
228 if(clients) | 253 if(clients) |
229 clients->prev = c; | 254 clients->prev = c; |
230 c->next = clients; | 255 c->next = clients; |
231 clients = c; | 256 clients = c; |
232 | 257 |
233 XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, | 258 grabbutton(c, Button1, MODKEY); |
234 GrabModeAsync, GrabModeSync, None, None); | 259 grabbutton(c, Button2, MODKEY); |
235 XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, | 260 grabbutton(c, Button3, MODKEY); |
236 GrabModeAsync, GrabModeSync, None, None); | |
237 XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK, | |
238 GrabModeAsync, GrabModeSync, None, None); | |
239 XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, | |
240 GrabModeAsync, GrabModeSync, None, None); | |
241 | |
242 XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK, | |
243 GrabModeAsync, GrabModeSync, None, None); | |
244 XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK, | |
245 GrabModeAsync, GrabModeSync, None, None); | |
246 XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK, | |
247 GrabModeAsync, GrabModeSync, None, None); | |
248 XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, | |
249 GrabModeAsync, GrabModeSync, None, None); | |
250 | |
251 XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, | |
252 GrabModeAsync, GrabModeSync, None, None); | |
253 XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK, | |
254 GrabModeAsync, GrabModeSync, None, None); | |
255 XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK, | |
256 GrabModeAsync, GrabModeSync, None, None); | |
257 XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, | |
258 GrabModeAsync, GrabModeSync, None, None); | |
259 | 261 |
260 settags(c); | 262 settags(c); |
261 if(!c->isfloat) | 263 if(!c->isfloat) |
262 c->isfloat = trans | 264 c->isfloat = trans |
263 || (c->maxw && c->minw && | 265 || (c->maxw && c->minw && |