author | arg@mmvi |
Fri, 22 Sep 2006 11:24:01 +0200 | |
changeset 478 | 635b58a87d20 |
parent 476 | 3e4596240abb |
child 482 | acb1fc729a8c |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
3 |
* See LICENSE file for license details. |
|
4 |
*/ |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
5 |
#include "dwm.h" |
5 | 6 |
#include <stdlib.h> |
7 |
#include <X11/keysym.h> |
|
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
8 |
#include <X11/Xatom.h> |
5 | 9 |
|
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
10 |
/* static */ |
114 | 11 |
|
12 |
typedef struct { |
|
13 |
unsigned long mod; |
|
14 |
KeySym keysym; |
|
15 |
void (*func)(Arg *arg); |
|
16 |
Arg arg; |
|
17 |
} Key; |
|
18 |
||
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
19 |
KEYS |
75 | 20 |
|
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
288
diff
changeset
|
21 |
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) |
75 | 22 |
|
77 | 23 |
static void |
476 | 24 |
synconfig(Client *c, int x, int y, int w, int h, unsigned int border) { |
25 |
XEvent synev; |
|
26 |
||
27 |
synev.type = ConfigureNotify; |
|
28 |
synev.xconfigure.display = dpy; |
|
29 |
synev.xconfigure.event = c->win; |
|
30 |
synev.xconfigure.window = c->win; |
|
31 |
synev.xconfigure.x = x; |
|
32 |
synev.xconfigure.y = y; |
|
33 |
synev.xconfigure.width = w; |
|
34 |
synev.xconfigure.height = h; |
|
35 |
synev.xconfigure.border_width = border; |
|
36 |
synev.xconfigure.above = None; |
|
37 |
XSendEvent(dpy, c->win, True, NoEventMask, &synev); |
|
38 |
} |
|
39 |
||
40 |
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
|
41 |
movemouse(Client *c) { |
77 | 42 |
int x1, y1, ocx, ocy, di; |
43 |
unsigned int dui; |
|
44 |
Window dummy; |
|
123 | 45 |
XEvent ev; |
77 | 46 |
|
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
|
47 |
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
|
48 |
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
|
49 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
123 | 50 |
None, cursor[CurMove], CurrentTime) != GrabSuccess) |
77 | 51 |
return; |
52 |
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
|
53 |
for(;;) { |
|
476 | 54 |
XMaskEvent(dpy, MOUSEMASK | ExposureMask | StructureNotifyMask, &ev); |
77 | 55 |
switch (ev.type) { |
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
|
56 |
default: |
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
|
57 |
break; |
476 | 58 |
case ConfigureRequest: |
59 |
synconfig(c, c->x, c->y, c->w, c->h, ev.xconfigure.border_width); |
|
60 |
XSync(dpy, False); |
|
61 |
break; |
|
77 | 62 |
case Expose: |
63 |
handler[Expose](&ev); |
|
64 |
break; |
|
65 |
case MotionNotify: |
|
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
66 |
XSync(dpy, False); |
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
|
67 |
c->x = ocx + (ev.xmotion.x - x1); |
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
|
68 |
c->y = ocy + (ev.xmotion.y - y1); |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
95
diff
changeset
|
69 |
resize(c, False, TopLeft); |
77 | 70 |
break; |
71 |
case ButtonRelease: |
|
72 |
XUngrabPointer(dpy, CurrentTime); |
|
73 |
return; |
|
476 | 74 |
case DestroyNotify: |
75 |
case UnmapNotify: |
|
76 |
XUngrabPointer(dpy, CurrentTime); |
|
77 |
handler[ev.type](&ev); |
|
78 |
return; |
|
77 | 79 |
} |
80 |
} |
|
81 |
} |
|
82 |
||
83 |
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
|
84 |
resizemouse(Client *c) { |
77 | 85 |
int ocx, ocy; |
268
a47b3b0d7bf4
applied Sanders LD and resize patches
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
86 |
int nw, nh; |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
95
diff
changeset
|
87 |
Corner sticky; |
123 | 88 |
XEvent ev; |
77 | 89 |
|
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
|
90 |
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
|
91 |
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
|
92 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
77 | 93 |
None, cursor[CurResize], CurrentTime) != GrabSuccess) |
94 |
return; |
|
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
|
95 |
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); |
77 | 96 |
for(;;) { |
476 | 97 |
XMaskEvent(dpy, MOUSEMASK | ExposureMask | StructureNotifyMask, &ev); |
77 | 98 |
switch(ev.type) { |
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
|
99 |
default: |
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
|
100 |
break; |
476 | 101 |
case ConfigureRequest: |
102 |
synconfig(c, c->x, c->y, c->w, c->h, ev.xconfigure.border_width); |
|
103 |
XSync(dpy, False); |
|
104 |
break; |
|
77 | 105 |
case Expose: |
106 |
handler[Expose](&ev); |
|
107 |
break; |
|
108 |
case MotionNotify: |
|
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
109 |
XSync(dpy, False); |
268
a47b3b0d7bf4
applied Sanders LD and resize patches
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
110 |
if((nw = abs(ocx - ev.xmotion.x))) |
478 | 111 |
c->w = nw; |
268
a47b3b0d7bf4
applied Sanders LD and resize patches
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
112 |
if((nh = abs(ocy - ev.xmotion.y))) |
478 | 113 |
c->h = nh; |
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
|
114 |
c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - c->w; |
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
|
115 |
c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - c->h; |
105 | 116 |
if(ocx <= ev.xmotion.x) |
117 |
sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft; |
|
118 |
else |
|
119 |
sticky = (ocy <= ev.xmotion.y) ? TopRight : BotRight; |
|
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
95
diff
changeset
|
120 |
resize(c, True, sticky); |
77 | 121 |
break; |
122 |
case ButtonRelease: |
|
123 |
XUngrabPointer(dpy, CurrentTime); |
|
124 |
return; |
|
476 | 125 |
case DestroyNotify: |
126 |
case UnmapNotify: |
|
127 |
XUngrabPointer(dpy, CurrentTime); |
|
128 |
handler[ev.type](&ev); |
|
129 |
return; |
|
77 | 130 |
} |
131 |
} |
|
132 |
} |
|
73 | 133 |
|
134 |
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
|
135 |
buttonpress(XEvent *e) { |
73 | 136 |
int x; |
137 |
Arg a; |
|
123 | 138 |
Client *c; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
139 |
XButtonPressedEvent *ev = &e->xbutton; |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
140 |
|
73 | 141 |
if(barwin == ev->window) { |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
142 |
x = 0; |
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
143 |
for(a.i = 0; a.i < ntags; a.i++) { |
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
144 |
x += textw(tags[a.i]); |
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
145 |
if(ev->x < x) { |
399 | 146 |
if(ev->button == Button1) { |
398 | 147 |
if(ev->state & MODKEY) |
148 |
tag(&a); |
|
149 |
else |
|
150 |
view(&a); |
|
399 | 151 |
} |
152 |
else if(ev->button == Button3) { |
|
398 | 153 |
if(ev->state & MODKEY) |
154 |
toggletag(&a); |
|
155 |
else |
|
156 |
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
|
157 |
} |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
158 |
return; |
73 | 159 |
} |
160 |
} |
|
371
fc9d35252ab4
applied sanders somepatches.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
362
diff
changeset
|
161 |
if(ev->x < x + bmw) { |
fc9d35252ab4
applied sanders somepatches.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
362
diff
changeset
|
162 |
if(ev->button == Button1) |
fc9d35252ab4
applied sanders somepatches.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
362
diff
changeset
|
163 |
togglemode(NULL); |
fc9d35252ab4
applied sanders somepatches.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
362
diff
changeset
|
164 |
} |
73 | 165 |
} |
58
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
55
diff
changeset
|
166 |
else if((c = getclient(ev->window))) { |
143 | 167 |
focus(c); |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
466
diff
changeset
|
168 |
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
|
169 |
return; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
399
diff
changeset
|
170 |
if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { |
399 | 171 |
restack(c); |
172 |
movemouse(c); |
|
173 |
} |
|
174 |
else if(ev->button == Button2) |
|
248
1227c21588e2
applied Sanders zoom_update patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
239
diff
changeset
|
175 |
zoom(NULL); |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
399
diff
changeset
|
176 |
else if(ev->button == Button3 && (arrange == dofloat || c->isfloat)) { |
399 | 177 |
restack(c); |
178 |
resizemouse(c); |
|
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
179 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
180 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
181 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
182 |
|
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
183 |
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
|
184 |
configurerequest(XEvent *e) { |
286 | 185 |
unsigned long newmask; |
123 | 186 |
Client *c; |
5 | 187 |
XConfigureRequestEvent *ev = &e->xconfigurerequest; |
188 |
XWindowChanges wc; |
|
189 |
||
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
190 |
if((c = getclient(ev->window))) { |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
466
diff
changeset
|
191 |
if((c == sel) && !c->isfloat && (arrange != dofloat)) { |
387
dca6aca09653
simplified configurerequest
Anselm R. Garbe <arg@10kloc.org>
parents:
386
diff
changeset
|
192 |
synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width); |
dca6aca09653
simplified configurerequest
Anselm R. Garbe <arg@10kloc.org>
parents:
386
diff
changeset
|
193 |
XSync(dpy, False); |
386
58288246d16c
now dwm enforces max screen size also in tiled mode on non-floating clients which are maximized
Anselm R. Garbe <arg@10kloc.org>
parents:
385
diff
changeset
|
194 |
return; |
58288246d16c
now dwm enforces max screen size also in tiled mode on non-floating clients which are maximized
Anselm R. Garbe <arg@10kloc.org>
parents:
385
diff
changeset
|
195 |
} |
29 | 196 |
gravitate(c, True); |
195
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
197 |
if(ev->value_mask & CWX) |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
198 |
c->x = ev->x; |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
199 |
if(ev->value_mask & CWY) |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
200 |
c->y = ev->y; |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
201 |
if(ev->value_mask & CWWidth) |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
202 |
c->w = ev->width; |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
203 |
if(ev->value_mask & CWHeight) |
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
204 |
c->h = ev->height; |
29 | 205 |
if(ev->value_mask & CWBorderWidth) |
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
|
206 |
c->border = ev->border_width; |
29 | 207 |
gravitate(c, False); |
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
|
208 |
wc.x = c->x; |
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
|
209 |
wc.y = c->y; |
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
|
210 |
wc.width = c->w; |
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
|
211 |
wc.height = c->h; |
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
|
212 |
newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth)); |
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
|
213 |
if(newmask) |
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
|
214 |
XConfigureWindow(dpy, c->win, newmask, &wc); |
387
dca6aca09653
simplified configurerequest
Anselm R. Garbe <arg@10kloc.org>
parents:
386
diff
changeset
|
215 |
else |
dca6aca09653
simplified configurerequest
Anselm R. Garbe <arg@10kloc.org>
parents:
386
diff
changeset
|
216 |
synconfig(c, c->x, c->y, c->w, c->h, c->border); |
195
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
217 |
XSync(dpy, False); |
385 | 218 |
if(c->isfloat) |
219 |
resize(c, False, TopLeft); |
|
196 | 220 |
else |
221 |
arrange(NULL); |
|
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
|
222 |
} |
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
|
223 |
else { |
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
|
224 |
wc.x = ev->x; |
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
|
225 |
wc.y = ev->y; |
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
|
226 |
wc.width = ev->width; |
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
|
227 |
wc.height = ev->height; |
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
|
228 |
wc.border_width = ev->border_width; |
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
|
229 |
wc.sibling = ev->above; |
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
|
230 |
wc.stack_mode = ev->detail; |
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
|
231 |
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); |
195
97960220eb77
fixed xterm font change (all other related apps should work fine with this fix as well)
arg@10ksloc.org
parents:
178
diff
changeset
|
232 |
XSync(dpy, False); |
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
|
233 |
} |
5 | 234 |
} |
235 |
||
236 |
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
|
237 |
destroynotify(XEvent *e) { |
5 | 238 |
Client *c; |
239 |
XDestroyWindowEvent *ev = &e->xdestroywindow; |
|
240 |
||
11 | 241 |
if((c = getclient(ev->window))) |
242 |
unmanage(c); |
|
5 | 243 |
} |
244 |
||
245 |
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
|
246 |
enternotify(XEvent *e) { |
123 | 247 |
Client *c; |
5 | 248 |
XCrossingEvent *ev = &e->xcrossing; |
249 |
||
232
98e9901b1dbb
disallow zoom on maximized clients
Anselm R.Garbe <arg@10ksloc.org>
parents:
231
diff
changeset
|
250 |
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
5 | 251 |
return; |
252 |
||
466 | 253 |
if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
254 |
focus(c); |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
255 |
else if(ev->window == root) { |
31 | 256 |
issel = True; |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
257 |
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
258 |
drawall(); |
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
259 |
} |
5 | 260 |
} |
261 |
||
262 |
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
|
263 |
expose(XEvent *e) { |
123 | 264 |
Client *c; |
5 | 265 |
XExposeEvent *ev = &e->xexpose; |
266 |
||
267 |
if(ev->count == 0) { |
|
70 | 268 |
if(barwin == ev->window) |
74 | 269 |
drawstatus(); |
75 | 270 |
else if((c = getctitle(ev->window))) |
74 | 271 |
drawtitle(c); |
5 | 272 |
} |
273 |
} |
|
274 |
||
275 |
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
|
276 |
keypress(XEvent *e) { |
138
c1185dc7a36e
some cleanups/fixes inspired by Jukka Salmi's feedback
arg@10ksloc.org
parents:
137
diff
changeset
|
277 |
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
|
278 |
unsigned int i; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
279 |
KeySym keysym; |
123 | 280 |
XKeyEvent *ev = &e->xkey; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
281 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
282 |
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
275 | 283 |
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
|
284 |
if(keysym == key[i].keysym |
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
|
285 |
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) |
275 | 286 |
{ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
287 |
if(key[i].func) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
288 |
key[i].func(&key[i].arg); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
289 |
return; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
290 |
} |
275 | 291 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
292 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
293 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
294 |
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
|
295 |
leavenotify(XEvent *e) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
296 |
XCrossingEvent *ev = &e->xcrossing; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
297 |
|
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
298 |
if((ev->window == root) && !ev->same_screen) { |
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
299 |
issel = False; |
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
300 |
drawall(); |
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
301 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
302 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
303 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
304 |
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
|
305 |
mappingnotify(XEvent *e) { |
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
306 |
XMappingEvent *ev = &e->xmapping; |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
307 |
|
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
308 |
XRefreshKeyboardMapping(ev); |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
309 |
if(ev->request == MappingKeyboard) |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
310 |
grabkeys(); |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
311 |
} |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
312 |
|
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
313 |
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
|
314 |
maprequest(XEvent *e) { |
123 | 315 |
static XWindowAttributes wa; |
5 | 316 |
XMapRequestEvent *ev = &e->xmaprequest; |
317 |
||
318 |
if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
|
319 |
return; |
|
320 |
||
321 |
if(wa.override_redirect) { |
|
322 |
XSelectInput(dpy, ev->window, |
|
323 |
(StructureNotifyMask | PropertyChangeMask)); |
|
324 |
return; |
|
325 |
} |
|
326 |
||
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
327 |
if(!getclient(ev->window)) |
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
328 |
manage(ev->window, &wa); |
5 | 329 |
} |
330 |
||
331 |
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
|
332 |
propertynotify(XEvent *e) { |
123 | 333 |
Client *c; |
53 | 334 |
Window trans; |
123 | 335 |
XPropertyEvent *ev = &e->xproperty; |
5 | 336 |
|
337 |
if(ev->state == PropertyDelete) |
|
338 |
return; /* ignore */ |
|
339 |
||
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
340 |
if((c = getclient(ev->window))) { |
77 | 341 |
if(ev->atom == wmatom[WMProtocols]) { |
75 | 342 |
c->proto = getproto(c->win); |
30
2e0fb4130bfb
new stuff, fixed several issues
Anselm R. Garbe <garbeam@wmii.de>
parents:
29
diff
changeset
|
343 |
return; |
2e0fb4130bfb
new stuff, fixed several issues
Anselm R. Garbe <garbeam@wmii.de>
parents:
29
diff
changeset
|
344 |
} |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
345 |
switch (ev->atom) { |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
346 |
default: break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
347 |
case XA_WM_TRANSIENT_FOR: |
53 | 348 |
XGetTransientForHint(dpy, c->win, &trans); |
80
8125f908c80c
several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
349 |
if(!c->isfloat && (c->isfloat = (trans != 0))) |
53 | 350 |
arrange(NULL); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
351 |
break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
352 |
case XA_WM_NORMAL_HINTS: |
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
|
353 |
updatesize(c); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
354 |
break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
355 |
} |
77 | 356 |
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
|
357 |
updatetitle(c); |
74 | 358 |
drawtitle(c); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
359 |
} |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
360 |
} |
5 | 361 |
} |
362 |
||
363 |
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
|
364 |
unmapnotify(XEvent *e) { |
5 | 365 |
Client *c; |
366 |
XUnmapEvent *ev = &e->xunmap; |
|
367 |
||
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
368 |
if((c = getclient(ev->window))) |
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
369 |
unmanage(c); |
5 | 370 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
371 |
|
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
80
diff
changeset
|
372 |
/* extern */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
373 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
374 |
void (*handler[LASTEvent]) (XEvent *) = { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
375 |
[ButtonPress] = buttonpress, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
376 |
[ConfigureRequest] = configurerequest, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
377 |
[DestroyNotify] = destroynotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
378 |
[EnterNotify] = enternotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
379 |
[LeaveNotify] = leavenotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
380 |
[Expose] = expose, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
381 |
[KeyPress] = keypress, |
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
382 |
[MappingNotify] = mappingnotify, |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
383 |
[MapRequest] = maprequest, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
384 |
[PropertyNotify] = propertynotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
385 |
[UnmapNotify] = unmapnotify |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
386 |
}; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
387 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
388 |
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
|
389 |
grabkeys() { |
138
c1185dc7a36e
some cleanups/fixes inspired by Jukka Salmi's feedback
arg@10ksloc.org
parents:
137
diff
changeset
|
390 |
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
|
391 |
unsigned int i; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
392 |
KeyCode code; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
393 |
|
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
394 |
XUngrabKey(dpy, AnyKey, AnyModifier, root); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
395 |
for(i = 0; i < len; i++) { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
396 |
code = XKeysymToKeycode(dpy, key[i].keysym); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
397 |
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
|
398 |
GrabModeAsync, GrabModeAsync); |
160 | 399 |
XGrabKey(dpy, code, key[i].mod | LockMask, root, True, |
400 |
GrabModeAsync, GrabModeAsync); |
|
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
288
diff
changeset
|
401 |
XGrabKey(dpy, code, key[i].mod | numlockmask, root, True, |
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
402 |
GrabModeAsync, GrabModeAsync); |
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
288
diff
changeset
|
403 |
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
|
404 |
GrabModeAsync, GrabModeAsync); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
405 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
406 |
} |
292 | 407 |
|
408 |
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
|
409 |
procevent() { |
292 | 410 |
XEvent ev; |
411 |
||
412 |
while(XPending(dpy)) { |
|
413 |
XNextEvent(dpy, &ev); |
|
414 |
if(handler[ev.type]) |
|
415 |
(handler[ev.type])(&ev); /* call handler */ |
|
416 |
} |
|
417 |
} |