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