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