author | Anselm R. Garbe <arg@suckless.org> |
Mon, 19 Feb 2007 11:34:12 +0100 | |
changeset 768 | b1dbe65d3e84 |
parent 767 | 074537180053 |
child 777 | 469dc170f833 |
permissions | -rw-r--r-- |
644 | 1 |
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com> |
5 | 2 |
* See LICENSE file for license details. |
3 |
*/ |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
4 |
#include "dwm.h" |
5 | 5 |
#include <stdlib.h> |
6 |
#include <X11/keysym.h> |
|
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
7 |
#include <X11/Xatom.h> |
5 | 8 |
|
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
9 |
/* static */ |
114 | 10 |
|
11 |
typedef struct { |
|
12 |
unsigned long mod; |
|
13 |
KeySym keysym; |
|
589 | 14 |
void (*func)(Arg *arg); |
114 | 15 |
Arg arg; |
16 |
} Key; |
|
17 |
||
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
18 |
KEYS |
75 | 19 |
|
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
288
diff
changeset
|
20 |
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) |
538
00ccae001069
moved MOUSEMASK into event.c (not used in other places)
Anselm R. Garbe <arg@10kloc.org>
parents:
533
diff
changeset
|
21 |
#define MOUSEMASK (BUTTONMASK | PointerMotionMask) |
75 | 22 |
|
77 | 23 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
24 |
movemouse(Client *c) { |
762
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
25 |
int x1, y1, ocx, ocy, di, nx, ny; |
77 | 26 |
unsigned int dui; |
27 |
Window dummy; |
|
123 | 28 |
XEvent ev; |
77 | 29 |
|
762
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
30 |
ocx = nx = c->x; |
764 | 31 |
ocy = ny = c->y; |
148
5267e1204367
uppercasing all define'd values (uppercase-prefixed should only be enum field qualifiers)
arg@10ksloc.org
parents:
146
diff
changeset
|
32 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
123 | 33 |
None, cursor[CurMove], CurrentTime) != GrabSuccess) |
77 | 34 |
return; |
482 | 35 |
c->ismax = False; |
77 | 36 |
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
37 |
for(;;) { |
|
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
38 |
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev); |
77 | 39 |
switch (ev.type) { |
490 | 40 |
case ButtonRelease: |
41 |
XUngrabPointer(dpy, CurrentTime); |
|
42 |
return; |
|
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
43 |
case ConfigureRequest: |
77 | 44 |
case Expose: |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
45 |
case MapRequest: |
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
46 |
handler[ev.type](&ev); |
77 | 47 |
break; |
48 |
case MotionNotify: |
|
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
49 |
XSync(dpy, False); |
762
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
50 |
nx = ocx + (ev.xmotion.x - x1); |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
51 |
ny = ocy + (ev.xmotion.y - y1); |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
52 |
if(abs(wax + nx) < SNAP) |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
53 |
nx = wax; |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
54 |
else if(abs((wax + waw) - (nx + c->w + 2 * c->border)) < SNAP) |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
55 |
nx = wax + waw - c->w - 2 * c->border; |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
56 |
if(abs(way - ny) < SNAP) |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
57 |
ny = way; |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
58 |
else if(abs((way + wah) - (ny + c->h + 2 * c->border)) < SNAP) |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
59 |
ny = way + wah - c->h - 2 * c->border; |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
60 |
resize(c, nx, ny, c->w, c->h, False); |
77 | 61 |
break; |
62 |
} |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
67 |
resizemouse(Client *c) { |
77 | 68 |
int ocx, ocy; |
268
a47b3b0d7bf4
applied Sanders LD and resize patches
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
69 |
int nw, nh; |
123 | 70 |
XEvent ev; |
77 | 71 |
|
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
72 |
ocx = c->x; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
73 |
ocy = c->y; |
148
5267e1204367
uppercasing all define'd values (uppercase-prefixed should only be enum field qualifiers)
arg@10ksloc.org
parents:
146
diff
changeset
|
74 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
75 |
None, cursor[CurResize], CurrentTime) != GrabSuccess) |
77 | 76 |
return; |
482 | 77 |
c->ismax = False; |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
78 |
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1); |
77 | 79 |
for(;;) { |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
80 |
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev); |
77 | 81 |
switch(ev.type) { |
490 | 82 |
case ButtonRelease: |
745
cf432071e646
added pointer warp on drop in resize
Anselm R. Garbe <arg@suckless.org>
parents:
734
diff
changeset
|
83 |
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, |
cf432071e646
added pointer warp on drop in resize
Anselm R. Garbe <arg@suckless.org>
parents:
734
diff
changeset
|
84 |
c->w + c->border - 1, c->h + c->border - 1); |
490 | 85 |
XUngrabPointer(dpy, CurrentTime); |
746
54e12eb664fc
removing all EnterNotifys after resize
Anselm R. Garbe <arg@suckless.org>
parents:
745
diff
changeset
|
86 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
490 | 87 |
return; |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
88 |
case ConfigureRequest: |
77 | 89 |
case Expose: |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
90 |
case MapRequest: |
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
91 |
handler[ev.type](&ev); |
77 | 92 |
break; |
93 |
case MotionNotify: |
|
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
94 |
XSync(dpy, False); |
762
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
95 |
if((nw = ev.xmotion.x - ocx - 2 * c->border + 1) <= 0) |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
96 |
nw = 1; |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
97 |
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
98 |
nh = 1; |
140bcd4782d8
removed ugly ban(), extended resize() that it only resets the size if necessary, added border_width commit to manage()
Anselm R. Garbe <arg@suckless.org>
parents:
760
diff
changeset
|
99 |
resize(c, c->x, c->y, nw, nh, True); |
77 | 100 |
break; |
101 |
} |
|
102 |
} |
|
103 |
} |
|
73 | 104 |
|
105 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
106 |
buttonpress(XEvent *e) { |
73 | 107 |
int x; |
108 |
Arg a; |
|
123 | 109 |
Client *c; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
110 |
XButtonPressedEvent *ev = &e->xbutton; |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
111 |
|
73 | 112 |
if(barwin == ev->window) { |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
113 |
x = 0; |
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
114 |
for(a.i = 0; a.i < ntags; a.i++) { |
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
115 |
x += textw(tags[a.i]); |
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
116 |
if(ev->x < x) { |
399 | 117 |
if(ev->button == Button1) { |
398 | 118 |
if(ev->state & MODKEY) |
119 |
tag(&a); |
|
120 |
else |
|
121 |
view(&a); |
|
399 | 122 |
} |
123 |
else if(ev->button == Button3) { |
|
398 | 124 |
if(ev->state & MODKEY) |
125 |
toggletag(&a); |
|
126 |
else |
|
127 |
toggleview(&a); |
|
394
1da9a6b94ca9
implemented Button2 press on tags for toggletag on the focused client
Anselm R. Garbe <arg@10kloc.org>
parents:
387
diff
changeset
|
128 |
} |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
129 |
return; |
73 | 130 |
} |
131 |
} |
|
676
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
132 |
if(ev->x < x + bmw) |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
133 |
switch(ev->button) { |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
134 |
case Button1: |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
135 |
togglemode(NULL); |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
136 |
break; |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
137 |
case Button4: |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
138 |
a.i = 1; |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
139 |
incnmaster(&a); |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
140 |
break; |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
141 |
case Button5: |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
142 |
a.i = -1; |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
143 |
incnmaster(&a); |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
144 |
break; |
7672a1041218
added comment to %u in config.default.h, added Button{4.5} support on mode label
Anselm R. Garbe <arg@suckless.org>
parents:
647
diff
changeset
|
145 |
} |
73 | 146 |
} |
58
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
55
diff
changeset
|
147 |
else if((c = getclient(ev->window))) { |
143 | 148 |
focus(c); |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
466
diff
changeset
|
149 |
if(CLEANMASK(ev->state) != MODKEY) |
318
1b45d6f14fca
applied Sanders focus_* patches, removed the unnecessary clean-prefix from the new function names
Anselm R.Garbe <arg@10ksloc.org>
parents:
292
diff
changeset
|
150 |
return; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
399
diff
changeset
|
151 |
if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { |
487 | 152 |
restack(); |
399 | 153 |
movemouse(c); |
154 |
} |
|
155 |
else if(ev->button == Button2) |
|
248
1227c21588e2
applied Sanders zoom_update patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
239
diff
changeset
|
156 |
zoom(NULL); |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
157 |
else if(ev->button == Button3 |
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
158 |
&& (arrange == dofloat || c->isfloat) && !c->isfixed) |
755
887d74605df8
I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;)
Anselm R. Garbe <arg@suckless.org>
parents:
753
diff
changeset
|
159 |
{ |
487 | 160 |
restack(); |
399 | 161 |
resizemouse(c); |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
162 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
163 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
164 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
165 |
|
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
166 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
167 |
configurerequest(XEvent *e) { |
123 | 168 |
Client *c; |
5 | 169 |
XConfigureRequestEvent *ev = &e->xconfigurerequest; |
170 |
XWindowChanges wc; |
|
171 |
||
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
172 |
if((c = getclient(ev->window))) { |
488 | 173 |
c->ismax = False; |
756
df3ea2f76f54
made configurerequest more tidy
Anselm R. Garbe <arg@suckless.org>
parents:
755
diff
changeset
|
174 |
if(ev->value_mask & CWBorderWidth) |
df3ea2f76f54
made configurerequest more tidy
Anselm R. Garbe <arg@suckless.org>
parents:
755
diff
changeset
|
175 |
c->border = ev->border_width; |
755
887d74605df8
I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;)
Anselm R. Garbe <arg@suckless.org>
parents:
753
diff
changeset
|
176 |
if(c->isfixed || c->isfloat || (arrange == dofloat)) { |
767
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
177 |
if(ev->value_mask & CWX) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
178 |
c->x = ev->x; |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
179 |
if(ev->value_mask & CWY) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
180 |
c->y = ev->y; |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
181 |
if(ev->value_mask & CWWidth) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
182 |
c->w = ev->width; |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
183 |
if(ev->value_mask & CWHeight) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
184 |
c->h = ev->height; |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
185 |
if((ev->value_mask & (CWX | CWY)) |
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
186 |
&& !(ev->value_mask & (CWWidth | CWHeight))) |
755
887d74605df8
I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;)
Anselm R. Garbe <arg@suckless.org>
parents:
753
diff
changeset
|
187 |
configure(c); |
768
b1dbe65d3e84
simplified configurerequest to a bare minimum, removed wrong ban() calls
Anselm R. Garbe <arg@suckless.org>
parents:
767
diff
changeset
|
188 |
if(isvisible(c)) |
767
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
189 |
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
505
2c29d74b11dc
first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents:
500
diff
changeset
|
190 |
} |
755
887d74605df8
I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;)
Anselm R. Garbe <arg@suckless.org>
parents:
753
diff
changeset
|
191 |
else |
887d74605df8
I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;)
Anselm R. Garbe <arg@suckless.org>
parents:
753
diff
changeset
|
192 |
configure(c); |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
163
diff
changeset
|
193 |
} |
753
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
194 |
else { |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
195 |
wc.x = ev->x; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
196 |
wc.y = ev->y; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
197 |
wc.width = ev->width; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
198 |
wc.height = ev->height; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
199 |
wc.border_width = ev->border_width; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
200 |
wc.sibling = ev->above; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
201 |
wc.stack_mode = ev->detail; |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
202 |
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); |
db484aa5c2cf
stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)
Anselm R. Garbe <arg@suckless.org>
parents:
752
diff
changeset
|
203 |
} |
752
9fe042b02e18
simplified configurerequest
Anselm R. Garbe <arg@suckless.org>
parents:
750
diff
changeset
|
204 |
XSync(dpy, False); |
5 | 205 |
} |
206 |
||
207 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
208 |
destroynotify(XEvent *e) { |
5 | 209 |
Client *c; |
210 |
XDestroyWindowEvent *ev = &e->xdestroywindow; |
|
211 |
||
11 | 212 |
if((c = getclient(ev->window))) |
213 |
unmanage(c); |
|
5 | 214 |
} |
215 |
||
216 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
217 |
enternotify(XEvent *e) { |
123 | 218 |
Client *c; |
5 | 219 |
XCrossingEvent *ev = &e->xcrossing; |
220 |
||
232
98e9901b1dbb
disallow zoom on maximized clients
Anselm R.Garbe <arg@10ksloc.org>
parents:
231
diff
changeset
|
221 |
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
5 | 222 |
return; |
687
a76799907854
removed client title bar
Anselm R. Garbe <arg@suckless.org>
parents:
676
diff
changeset
|
223 |
if((c = getclient(ev->window)) && isvisible(c)) |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
224 |
focus(c); |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
225 |
else if(ev->window == root) { |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
226 |
selscreen = True; |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
227 |
for(c = stack; c && !isvisible(c); c = c->snext); |
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
228 |
focus(c); |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
229 |
} |
5 | 230 |
} |
231 |
||
232 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
233 |
expose(XEvent *e) { |
5 | 234 |
XExposeEvent *ev = &e->xexpose; |
235 |
||
236 |
if(ev->count == 0) { |
|
70 | 237 |
if(barwin == ev->window) |
74 | 238 |
drawstatus(); |
5 | 239 |
} |
240 |
} |
|
241 |
||
242 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
243 |
keypress(XEvent *e) { |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
565
diff
changeset
|
244 |
static unsigned int len = sizeof key / sizeof key[0]; |
589 | 245 |
unsigned int i; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
246 |
KeySym keysym; |
123 | 247 |
XKeyEvent *ev = &e->xkey; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
248 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
249 |
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
250 |
for(i = 0; i < len; i++) |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
251 |
if(keysym == key[i].keysym |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
252 |
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) |
275 | 253 |
{ |
589 | 254 |
if(key[i].func) |
255 |
key[i].func(&key[i].arg); |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
256 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
257 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
258 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
259 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
260 |
leavenotify(XEvent *e) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
261 |
XCrossingEvent *ev = &e->xcrossing; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
262 |
|
701
fc5b982778df
applied a modified version of Christof Musik's multihead patch (though this is not sure if it works in all cases, have to wait for an ACK by Christof)
Anselm R. Garbe <arg@suckless.org>
parents:
692
diff
changeset
|
263 |
if((ev->window == root) && !ev->same_screen) { |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
264 |
selscreen = False; |
711
b40134b93de3
I think this is the best solution of multihead support
Anselm R. Garbe <arg@suckless.org>
parents:
709
diff
changeset
|
265 |
focus(NULL); |
701
fc5b982778df
applied a modified version of Christof Musik's multihead patch (though this is not sure if it works in all cases, have to wait for an ACK by Christof)
Anselm R. Garbe <arg@suckless.org>
parents:
692
diff
changeset
|
266 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
267 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
268 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
269 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
270 |
mappingnotify(XEvent *e) { |
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
271 |
XMappingEvent *ev = &e->xmapping; |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
272 |
|
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
273 |
XRefreshKeyboardMapping(ev); |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
274 |
if(ev->request == MappingKeyboard) |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
275 |
grabkeys(); |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
276 |
} |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
277 |
|
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
278 |
static void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
279 |
maprequest(XEvent *e) { |
123 | 280 |
static XWindowAttributes wa; |
5 | 281 |
XMapRequestEvent *ev = &e->xmaprequest; |
282 |
||
283 |
if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
|
284 |
return; |
|
750
154b5d4b4a26
I don't see any reason why we should select for input on override-redirect windows?
Anselm R. Garbe <arg@suckless.org>
parents:
746
diff
changeset
|
285 |
if(wa.override_redirect) |
5 | 286 |
return; |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
287 |
if(!getclient(ev->window)) |
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
288 |
manage(ev->window, &wa); |
5 | 289 |
} |
290 |
||
291 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
292 |
propertynotify(XEvent *e) { |
123 | 293 |
Client *c; |
53 | 294 |
Window trans; |
123 | 295 |
XPropertyEvent *ev = &e->xproperty; |
5 | 296 |
|
297 |
if(ev->state == PropertyDelete) |
|
298 |
return; /* ignore */ |
|
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
299 |
if((c = getclient(ev->window))) { |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
300 |
switch (ev->atom) { |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
301 |
default: break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
302 |
case XA_WM_TRANSIENT_FOR: |
53 | 303 |
XGetTransientForHint(dpy, c->win, &trans); |
80
8125f908c80c
several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
304 |
if(!c->isfloat && (c->isfloat = (trans != 0))) |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
305 |
arrange(); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
306 |
break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
307 |
case XA_WM_NORMAL_HINTS: |
639
226ef912c093
renamed updatesize into updatesizehints (thx to Sander for this hint)
arg@mig29
parents:
630
diff
changeset
|
308 |
updatesizehints(c); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
309 |
break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
310 |
} |
77 | 311 |
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { |
454
ffb462fb7903
small change to comments, renamed two set* functions in client.c into update*
Anselm R. Garbe <arg@10kloc.org>
parents:
400
diff
changeset
|
312 |
updatetitle(c); |
690
399f08187c27
removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles)
Anselm R. Garbe <arg@suckless.org>
parents:
687
diff
changeset
|
313 |
if(c == sel) |
399f08187c27
removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles)
Anselm R. Garbe <arg@suckless.org>
parents:
687
diff
changeset
|
314 |
drawstatus(); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
315 |
} |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
316 |
} |
5 | 317 |
} |
318 |
||
319 |
static void |
|
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
454
diff
changeset
|
320 |
unmapnotify(XEvent *e) { |
5 | 321 |
Client *c; |
322 |
XUnmapEvent *ev = &e->xunmap; |
|
323 |
||
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
324 |
if((c = getclient(ev->window))) |
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
325 |
unmanage(c); |
5 | 326 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
327 |
|
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
80
diff
changeset
|
328 |
/* extern */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
329 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
330 |
void (*handler[LASTEvent]) (XEvent *) = { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
331 |
[ButtonPress] = buttonpress, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
332 |
[ConfigureRequest] = configurerequest, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
333 |
[DestroyNotify] = destroynotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
334 |
[EnterNotify] = enternotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
335 |
[LeaveNotify] = leavenotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
336 |
[Expose] = expose, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
337 |
[KeyPress] = keypress, |
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
338 |
[MappingNotify] = mappingnotify, |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
339 |
[MapRequest] = maprequest, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
340 |
[PropertyNotify] = propertynotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
341 |
[UnmapNotify] = unmapnotify |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
342 |
}; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
343 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
344 |
void |
487 | 345 |
grabkeys(void) { |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
565
diff
changeset
|
346 |
static unsigned int len = sizeof key / sizeof key[0]; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
347 |
unsigned int i; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
348 |
KeyCode code; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
349 |
|
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
350 |
XUngrabKey(dpy, AnyKey, AnyModifier, root); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
351 |
for(i = 0; i < len; i++) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
352 |
code = XKeysymToKeycode(dpy, key[i].keysym); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
353 |
XGrabKey(dpy, code, key[i].mod, root, True, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
354 |
GrabModeAsync, GrabModeAsync); |
160 | 355 |
XGrabKey(dpy, code, key[i].mod | LockMask, root, True, |
356 |
GrabModeAsync, GrabModeAsync); |
|
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
288
diff
changeset
|
357 |
XGrabKey(dpy, code, key[i].mod | numlockmask, root, True, |
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
358 |
GrabModeAsync, GrabModeAsync); |
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
288
diff
changeset
|
359 |
XGrabKey(dpy, code, key[i].mod | numlockmask | LockMask, root, True, |
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
360 |
GrabModeAsync, GrabModeAsync); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
361 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
362 |
} |
292 | 363 |
|
364 |
void |
|
487 | 365 |
procevent(void) { |
292 | 366 |
XEvent ev; |
367 |
||
368 |
while(XPending(dpy)) { |
|
369 |
XNextEvent(dpy, &ev); |
|
370 |
if(handler[ev.type]) |
|
371 |
(handler[ev.type])(&ev); /* call handler */ |
|
372 |
} |
|
373 |
} |