9 #include <X11/Xutil.h> |
9 #include <X11/Xutil.h> |
10 |
10 |
11 /* static functions */ |
11 /* static functions */ |
12 |
12 |
13 static void |
13 static void |
14 grabbutton(Client *c, unsigned int button, unsigned int modifier) |
14 grabbuttons(Client *c, Bool focus) |
15 { |
15 { |
16 XGrabButton(dpy, button, modifier, c->win, False, BUTTONMASK, |
16 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
17 GrabModeAsync, GrabModeSync, None, None); |
17 |
18 XGrabButton(dpy, button, modifier | LockMask, c->win, False, BUTTONMASK, |
18 if(focus) { |
19 GrabModeAsync, GrabModeSync, None, None); |
19 XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, |
20 XGrabButton(dpy, button, modifier | numlockmask, c->win, False, BUTTONMASK, |
20 GrabModeAsync, GrabModeSync, None, None); |
21 GrabModeAsync, GrabModeSync, None, None); |
21 XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, |
22 XGrabButton(dpy, button, modifier | numlockmask | LockMask, c->win, False, BUTTONMASK, |
22 GrabModeAsync, GrabModeSync, None, None); |
23 GrabModeAsync, GrabModeSync, None, None); |
23 XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
|
24 GrabModeAsync, GrabModeSync, None, None); |
|
25 XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
|
26 GrabModeAsync, GrabModeSync, None, None); |
|
27 |
|
28 XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK, |
|
29 GrabModeAsync, GrabModeSync, None, None); |
|
30 XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK, |
|
31 GrabModeAsync, GrabModeSync, None, None); |
|
32 XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
|
33 GrabModeAsync, GrabModeSync, None, None); |
|
34 XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
|
35 GrabModeAsync, GrabModeSync, None, None); |
|
36 |
|
37 XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, |
|
38 GrabModeAsync, GrabModeSync, None, None); |
|
39 XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK, |
|
40 GrabModeAsync, GrabModeSync, None, None); |
|
41 XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
|
42 GrabModeAsync, GrabModeSync, None, None); |
|
43 XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
|
44 GrabModeAsync, GrabModeSync, None, None); |
|
45 } |
|
46 else |
|
47 XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, |
|
48 GrabModeAsync, GrabModeSync, None, None); |
|
49 |
24 } |
50 } |
25 |
51 |
26 static void |
52 static void |
27 resizetitle(Client *c) |
53 resizetitle(Client *c) |
28 { |
54 { |
36 if(isvisible(c)) |
62 if(isvisible(c)) |
37 XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); |
63 XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); |
38 else |
64 else |
39 XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); |
65 XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); |
40 |
66 |
41 } |
|
42 |
|
43 static void |
|
44 ungrabbutton(Client *c, unsigned int button, unsigned int modifier) |
|
45 { |
|
46 XUngrabButton(dpy, button, modifier, c->win); |
|
47 XUngrabButton(dpy, button, modifier | LockMask, c->win); |
|
48 XUngrabButton(dpy, button, modifier | numlockmask, c->win); |
|
49 XUngrabButton(dpy, button, modifier | numlockmask | LockMask, c->win); |
|
50 } |
67 } |
51 |
68 |
52 static int |
69 static int |
53 xerrordummy(Display *dsply, XErrorEvent *ee) |
70 xerrordummy(Display *dsply, XErrorEvent *ee) |
54 { |
71 { |