author | Anselm R. Garbe <garbeam@gmail.com> |
Thu, 16 Aug 2007 18:41:22 +0200 | |
changeset 958 | 8b502be8b8e0 |
parent 956 | 484245788760 |
child 971 | b2a0dfa22b1d |
permissions | -rw-r--r-- |
910
c13cb8c6b7a5
referred to LICENSE file
Anselm R. Garbe <arg@suckless.org>
parents:
909
diff
changeset
|
1 |
/* See LICENSE file for copyright and license details. */ |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
2 |
#include "dwm.h" |
5 | 3 |
#include <stdlib.h> |
4 |
#include <X11/keysym.h> |
|
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
5 |
#include <X11/Xatom.h> |
953 | 6 |
#include <X11/Xutil.h> |
5 | 7 |
|
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
8 |
/* static */ |
114 | 9 |
|
10 |
typedef struct { |
|
11 |
unsigned long mod; |
|
12 |
KeySym keysym; |
|
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
821
diff
changeset
|
13 |
void (*func)(const char *arg); |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
821
diff
changeset
|
14 |
const char *arg; |
114 | 15 |
} Key; |
16 |
||
926
6f9cf0cfe278
removed shiftview(), if you scroll the views in the tag area, you can also use Button1 instead
Anselm R. Garbe <garbeam@gmail.com>
parents:
925
diff
changeset
|
17 |
#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
|
18 |
#define MOUSEMASK (BUTTONMASK | PointerMotionMask) |
75 | 19 |
|
777
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
20 |
static Client * |
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
21 |
getclient(Window w) { |
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
22 |
Client *c; |
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
23 |
|
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
24 |
for(c = clients; c && c->win != w; c = c->next); |
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
25 |
return c; |
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
26 |
} |
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
768
diff
changeset
|
27 |
|
77 | 28 |
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
|
29 |
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
|
30 |
int x1, y1, ocx, ocy, di, nx, ny; |
77 | 31 |
unsigned int dui; |
32 |
Window dummy; |
|
123 | 33 |
XEvent ev; |
77 | 34 |
|
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
|
35 |
ocx = nx = c->x; |
764 | 36 |
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
|
37 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
123 | 38 |
None, cursor[CurMove], CurrentTime) != GrabSuccess) |
77 | 39 |
return; |
482 | 40 |
c->ismax = False; |
77 | 41 |
XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
42 |
for(;;) { |
|
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
43 |
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev); |
77 | 44 |
switch (ev.type) { |
490 | 45 |
case ButtonRelease: |
46 |
XUngrabPointer(dpy, CurrentTime); |
|
47 |
return; |
|
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
48 |
case ConfigureRequest: |
77 | 49 |
case Expose: |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
50 |
case MapRequest: |
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
51 |
handler[ev.type](&ev); |
77 | 52 |
break; |
53 |
case MotionNotify: |
|
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
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
|
63 |
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
|
64 |
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
|
65 |
resize(c, nx, ny, c->w, c->h, False); |
77 | 66 |
break; |
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
||
71 |
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
|
72 |
resizemouse(Client *c) { |
77 | 73 |
int ocx, ocy; |
268
a47b3b0d7bf4
applied Sanders LD and resize patches
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
74 |
int nw, nh; |
123 | 75 |
XEvent ev; |
77 | 76 |
|
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
|
77 |
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
|
78 |
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
|
79 |
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
|
80 |
None, cursor[CurResize], CurrentTime) != GrabSuccess) |
77 | 81 |
return; |
482 | 82 |
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
|
83 |
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1); |
77 | 84 |
for(;;) { |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
85 |
XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev); |
77 | 86 |
switch(ev.type) { |
490 | 87 |
case ButtonRelease: |
745
cf432071e646
added pointer warp on drop in resize
Anselm R. Garbe <arg@suckless.org>
parents:
734
diff
changeset
|
88 |
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
|
89 |
c->w + c->border - 1, c->h + c->border - 1); |
490 | 90 |
XUngrabPointer(dpy, CurrentTime); |
746
54e12eb664fc
removing all EnterNotifys after resize
Anselm R. Garbe <arg@suckless.org>
parents:
745
diff
changeset
|
91 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
490 | 92 |
return; |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
93 |
case ConfigureRequest: |
77 | 94 |
case Expose: |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
95 |
case MapRequest: |
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
707
diff
changeset
|
96 |
handler[ev.type](&ev); |
77 | 97 |
break; |
98 |
case MotionNotify: |
|
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
99 |
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
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
resize(c, c->x, c->y, nw, nh, True); |
77 | 105 |
break; |
106 |
} |
|
107 |
} |
|
108 |
} |
|
73 | 109 |
|
110 |
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
|
111 |
buttonpress(XEvent *e) { |
825
bef1854ce739
fixed some issues due to the Arg->const char * transition
Anselm R. Garbe <arg@suckless.org>
parents:
823
diff
changeset
|
112 |
unsigned int i, x; |
123 | 113 |
Client *c; |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
114 |
XButtonPressedEvent *ev = &e->xbutton; |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
115 |
|
73 | 116 |
if(barwin == ev->window) { |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
117 |
x = 0; |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
821
diff
changeset
|
118 |
for(i = 0; i < ntags; i++) { |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
821
diff
changeset
|
119 |
x += textw(tags[i]); |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
120 |
if(ev->x < x) { |
399 | 121 |
if(ev->button == Button1) { |
398 | 122 |
if(ev->state & MODKEY) |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
123 |
tag(tags[i]); |
398 | 124 |
else |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
125 |
view(tags[i]); |
399 | 126 |
} |
127 |
else if(ev->button == Button3) { |
|
398 | 128 |
if(ev->state & MODKEY) |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
129 |
toggletag(tags[i]); |
398 | 130 |
else |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
131 |
toggleview(tags[i]); |
394
1da9a6b94ca9
implemented Button2 press on tags for toggletag on the focused client
Anselm R. Garbe <arg@10kloc.org>
parents:
387
diff
changeset
|
132 |
} |
362
ba6c55e1b9b2
trying a different configuration
Anselm R. Garbe <arg@10kloc.org>
parents:
356
diff
changeset
|
133 |
return; |
73 | 134 |
} |
135 |
} |
|
926
6f9cf0cfe278
removed shiftview(), if you scroll the views in the tag area, you can also use Button1 instead
Anselm R. Garbe <garbeam@gmail.com>
parents:
925
diff
changeset
|
136 |
if((ev->x < x + blw) && ev->button == Button1) |
925
10df275327ce
applied Jeroen's {clean,spell}.diff patches, thanks Jeroen!
Anselm R. Garbe <garbeam@gmail.com>
parents:
924
diff
changeset
|
137 |
setlayout(NULL); |
73 | 138 |
} |
58
1269bd127551
made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
55
diff
changeset
|
139 |
else if((c = getclient(ev->window))) { |
143 | 140 |
focus(c); |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
466
diff
changeset
|
141 |
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
|
142 |
return; |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
143 |
if(ev->button == Button1 && (isfloating() || c->isfloating)) { |
487 | 144 |
restack(); |
399 | 145 |
movemouse(c); |
146 |
} |
|
147 |
else if(ev->button == Button2) |
|
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
821
diff
changeset
|
148 |
zoom(NULL); |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
149 |
else if(ev->button == Button3 |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
150 |
&& (isfloating() || c->isfloating) && !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
|
151 |
{ |
487 | 152 |
restack(); |
399 | 153 |
resizemouse(c); |
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
154 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
155 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
156 |
} |
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
157 |
|
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
158 |
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
|
159 |
configurerequest(XEvent *e) { |
123 | 160 |
Client *c; |
5 | 161 |
XConfigureRequestEvent *ev = &e->xconfigurerequest; |
162 |
XWindowChanges wc; |
|
163 |
||
18
1efa34c6e1b6
added mouse-based resizals
Anselm R. Garbe <garbeam@wmii.de>
parents:
16
diff
changeset
|
164 |
if((c = getclient(ev->window))) { |
488 | 165 |
c->ismax = False; |
860
9d9fd4575591
changing order of c->border restorage
Anselm R. Garbe <arg@suckless.org>
parents:
858
diff
changeset
|
166 |
if(ev->value_mask & CWBorderWidth) |
9d9fd4575591
changing order of c->border restorage
Anselm R. Garbe <arg@suckless.org>
parents:
858
diff
changeset
|
167 |
c->border = ev->border_width; |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
168 |
if(c->isfixed || c->isfloating || isfloating()) { |
767
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
169 |
if(ev->value_mask & CWX) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
170 |
c->x = ev->x; |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
171 |
if(ev->value_mask & CWY) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
172 |
c->y = ev->y; |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
173 |
if(ev->value_mask & CWWidth) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
174 |
c->w = ev->width; |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
175 |
if(ev->value_mask & CWHeight) |
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
176 |
c->h = ev->height; |
872
c7b4661e8902
applied Maarten Maathuis recenter-patch for floating clients only requesting new width and height exceeding the screen space
Anselm R. Garbe <arg@suckless.org>
parents:
869
diff
changeset
|
177 |
if((c->x + c->w) > sw && c->isfloating) |
c7b4661e8902
applied Maarten Maathuis recenter-patch for floating clients only requesting new width and height exceeding the screen space
Anselm R. Garbe <arg@suckless.org>
parents:
869
diff
changeset
|
178 |
c->x = sw / 2 - c->w / 2; /* center in x direction */ |
c7b4661e8902
applied Maarten Maathuis recenter-patch for floating clients only requesting new width and height exceeding the screen space
Anselm R. Garbe <arg@suckless.org>
parents:
869
diff
changeset
|
179 |
if((c->y + c->h) > sh && c->isfloating) |
c7b4661e8902
applied Maarten Maathuis recenter-patch for floating clients only requesting new width and height exceeding the screen space
Anselm R. Garbe <arg@suckless.org>
parents:
869
diff
changeset
|
180 |
c->y = sh / 2 - c->h / 2; /* center in y direction */ |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
756
diff
changeset
|
181 |
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
|
182 |
&& !(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
|
183 |
configure(c); |
768
b1dbe65d3e84
simplified configurerequest to a bare minimum, removed wrong ban() calls
Anselm R. Garbe <arg@suckless.org>
parents:
767
diff
changeset
|
184 |
if(isvisible(c)) |
767
074537180053
fixed configurerequest according to Jukkas complains
Anselm R. Garbe <arg@suckless.org>
parents:
766
diff
changeset
|
185 |
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
|
186 |
} |
861 | 187 |
else |
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
|
188 |
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
|
189 |
} |
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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
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
|
195 |
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
|
196 |
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
|
197 |
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
|
198 |
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
|
199 |
} |
752
9fe042b02e18
simplified configurerequest
Anselm R. Garbe <arg@suckless.org>
parents:
750
diff
changeset
|
200 |
XSync(dpy, False); |
5 | 201 |
} |
202 |
||
203 |
static void |
|
867
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
204 |
configurenotify(XEvent *e) { |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
205 |
XConfigureEvent *ev = &e->xconfigure; |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
206 |
|
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
207 |
if (ev->window == root && (ev->width != sw || ev->height != sh)) { |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
208 |
sw = ev->width; |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
209 |
sh = ev->height; |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
210 |
XFreePixmap(dpy, dc.drawable); |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
211 |
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
212 |
XResizeWindow(dpy, barwin, sw, bh); |
897
0a78c9e46e24
fixed issue reported by Christian Garbs
Anselm R. Garbe <arg@suckless.org>
parents:
875
diff
changeset
|
213 |
updatebarpos(); |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
214 |
arrange(); |
867
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
215 |
} |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
216 |
} |
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
217 |
|
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
218 |
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
|
219 |
destroynotify(XEvent *e) { |
5 | 220 |
Client *c; |
221 |
XDestroyWindowEvent *ev = &e->xdestroywindow; |
|
222 |
||
11 | 223 |
if((c = getclient(ev->window))) |
953 | 224 |
unmanage(c, WithdrawnState); |
5 | 225 |
} |
226 |
||
227 |
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
|
228 |
enternotify(XEvent *e) { |
123 | 229 |
Client *c; |
5 | 230 |
XCrossingEvent *ev = &e->xcrossing; |
231 |
||
232
98e9901b1dbb
disallow zoom on maximized clients
Anselm R.Garbe <arg@10ksloc.org>
parents:
231
diff
changeset
|
232 |
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
5 | 233 |
return; |
908 | 234 |
if((c = getclient(ev->window))) |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
235 |
focus(c); |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
236 |
else if(ev->window == root) { |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
237 |
selscreen = True; |
904
2dfd50e4cfde
applied anydot's 3 minor patches, thank you anydot
Anselm R. Garbe <arg@suckless.org>
parents:
897
diff
changeset
|
238 |
focus(NULL); |
239
e5390f8e06b9
applied sumik's multihead patch
Anselm R.Garbe <arg@10ksloc.org>
parents:
238
diff
changeset
|
239 |
} |
5 | 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 |
expose(XEvent *e) { |
5 | 244 |
XExposeEvent *ev = &e->xexpose; |
245 |
||
246 |
if(ev->count == 0) { |
|
70 | 247 |
if(barwin == ev->window) |
74 | 248 |
drawstatus(); |
5 | 249 |
} |
250 |
} |
|
251 |
||
252 |
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
|
253 |
keypress(XEvent *e) { |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
254 |
KEYS |
958 | 255 |
unsigned int len = sizeof keys / sizeof keys[0]; |
589 | 256 |
unsigned int i; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
257 |
KeySym keysym; |
123 | 258 |
XKeyEvent *ev = &e->xkey; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
259 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
260 |
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
|
261 |
for(i = 0; i < len; i++) |
958 | 262 |
if(keysym == keys[i].keysym |
263 |
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)) |
|
275 | 264 |
{ |
958 | 265 |
if(keys[i].func) |
266 |
keys[i].func(keys[i].arg); |
|
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 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
270 |
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
|
271 |
leavenotify(XEvent *e) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
272 |
XCrossingEvent *ev = &e->xcrossing; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
273 |
|
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
|
274 |
if((ev->window == root) && !ev->same_screen) { |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
275 |
selscreen = False; |
711
b40134b93de3
I think this is the best solution of multihead support
Anselm R. Garbe <arg@suckless.org>
parents:
709
diff
changeset
|
276 |
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
|
277 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
278 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
279 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
280 |
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
|
281 |
mappingnotify(XEvent *e) { |
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
282 |
XMappingEvent *ev = &e->xmapping; |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
283 |
|
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
284 |
XRefreshKeyboardMapping(ev); |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
285 |
if(ev->request == MappingKeyboard) |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
286 |
grabkeys(); |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
287 |
} |
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
288 |
|
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
289 |
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
|
290 |
maprequest(XEvent *e) { |
123 | 291 |
static XWindowAttributes wa; |
5 | 292 |
XMapRequestEvent *ev = &e->xmaprequest; |
293 |
||
294 |
if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
|
295 |
return; |
|
921
e0ec0d5d8b1e
restoring tip to be a working dwm again (switching FONT to terminus in config.arg.h)
arg@f00b4r
parents:
920
diff
changeset
|
296 |
if(wa.override_redirect) |
5 | 297 |
return; |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
298 |
if(!getclient(ev->window)) |
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
299 |
manage(ev->window, &wa); |
5 | 300 |
} |
301 |
||
302 |
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
|
303 |
propertynotify(XEvent *e) { |
123 | 304 |
Client *c; |
53 | 305 |
Window trans; |
123 | 306 |
XPropertyEvent *ev = &e->xproperty; |
5 | 307 |
|
308 |
if(ev->state == PropertyDelete) |
|
309 |
return; /* ignore */ |
|
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
310 |
if((c = getclient(ev->window))) { |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
311 |
switch (ev->atom) { |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
312 |
default: break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
313 |
case XA_WM_TRANSIENT_FOR: |
53 | 314 |
XGetTransientForHint(dpy, c->win, &trans); |
837
123231b9eb87
renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
315 |
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL))) |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
316 |
arrange(); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
317 |
break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
318 |
case XA_WM_NORMAL_HINTS: |
639
226ef912c093
renamed updatesize into updatesizehints (thx to Sander for this hint)
arg@mig29
parents:
630
diff
changeset
|
319 |
updatesizehints(c); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
320 |
break; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
321 |
} |
77 | 322 |
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
|
323 |
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
|
324 |
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
|
325 |
drawstatus(); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
326 |
} |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
11
diff
changeset
|
327 |
} |
5 | 328 |
} |
329 |
||
330 |
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
|
331 |
unmapnotify(XEvent *e) { |
5 | 332 |
Client *c; |
333 |
XUnmapEvent *ev = &e->xunmap; |
|
334 |
||
927
60d5a92ce85c
changed ban/unban implementation to not move the windows anymore, but map/unmap them instead - PLEASE TEST THIS
Anselm R. Garbe <garbeam@gmail.com>
parents:
926
diff
changeset
|
335 |
if((c = getclient(ev->window)) && (ev->event == root)) { |
60d5a92ce85c
changed ban/unban implementation to not move the windows anymore, but map/unmap them instead - PLEASE TEST THIS
Anselm R. Garbe <garbeam@gmail.com>
parents:
926
diff
changeset
|
336 |
if(ev->send_event || c->unmapped-- == 0) |
953 | 337 |
unmanage(c, WithdrawnState); |
927
60d5a92ce85c
changed ban/unban implementation to not move the windows anymore, but map/unmap them instead - PLEASE TEST THIS
Anselm R. Garbe <garbeam@gmail.com>
parents:
926
diff
changeset
|
338 |
} |
5 | 339 |
} |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
340 |
|
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
80
diff
changeset
|
341 |
/* extern */ |
76
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 |
void (*handler[LASTEvent]) (XEvent *) = { |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
344 |
[ButtonPress] = buttonpress, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
345 |
[ConfigureRequest] = configurerequest, |
867
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
861
diff
changeset
|
346 |
[ConfigureNotify] = configurenotify, |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
347 |
[DestroyNotify] = destroynotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
348 |
[EnterNotify] = enternotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
349 |
[LeaveNotify] = leavenotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
350 |
[Expose] = expose, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
351 |
[KeyPress] = keypress, |
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
352 |
[MappingNotify] = mappingnotify, |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
353 |
[MapRequest] = maprequest, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
354 |
[PropertyNotify] = propertynotify, |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
355 |
[UnmapNotify] = unmapnotify |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
356 |
}; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
357 |
|
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
358 |
void |
487 | 359 |
grabkeys(void) { |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
360 |
KEYS |
958 | 361 |
unsigned int len = sizeof keys / sizeof keys[0]; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
362 |
unsigned int i; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
363 |
KeyCode code; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
364 |
|
279
2cedfbefd025
added mappingnotify event for kb refreshes
Anselm R.Garbe <arg@10ksloc.org>
parents:
278
diff
changeset
|
365 |
XUngrabKey(dpy, AnyKey, AnyModifier, root); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
366 |
for(i = 0; i < len; i++) { |
958 | 367 |
code = XKeysymToKeycode(dpy, keys[i].keysym); |
368 |
XGrabKey(dpy, code, keys[i].mod, root, True, |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
369 |
GrabModeAsync, GrabModeAsync); |
958 | 370 |
XGrabKey(dpy, code, keys[i].mod | LockMask, root, True, |
160 | 371 |
GrabModeAsync, GrabModeAsync); |
958 | 372 |
XGrabKey(dpy, code, keys[i].mod | numlockmask, root, True, |
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
373 |
GrabModeAsync, GrabModeAsync); |
958 | 374 |
XGrabKey(dpy, code, keys[i].mod | numlockmask | LockMask, root, True, |
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
145
diff
changeset
|
375 |
GrabModeAsync, GrabModeAsync); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
376 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
377 |
} |