author | Anselm R. Garbe <garbeam@gmail.com> |
Sat, 15 Sep 2007 20:39:31 +0200 | |
changeset 989 | 5f7018237edb |
parent 988 | aea51354bbe6 |
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" |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
3 |
#include <errno.h> |
619 | 4 |
#include <locale.h> |
0 | 5 |
#include <stdio.h> |
6 |
#include <stdlib.h> |
|
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
52
diff
changeset
|
7 |
#include <string.h> |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
8 |
#include <unistd.h> |
138
c1185dc7a36e
some cleanups/fixes inspired by Jukka Salmi's feedback
arg@10ksloc.org
parents:
137
diff
changeset
|
9 |
#include <sys/select.h> |
0 | 10 |
#include <X11/cursorfont.h> |
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
281
diff
changeset
|
11 |
#include <X11/keysym.h> |
0 | 12 |
#include <X11/Xatom.h> |
13 |
#include <X11/Xproto.h> |
|
953 | 14 |
#include <X11/Xutil.h> |
0 | 15 |
|
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
16 |
/* extern */ |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
17 |
|
688
39fa5308d73f
removed mode label stuff
Anselm R. Garbe <arg@suckless.org>
parents:
679
diff
changeset
|
18 |
char stext[256]; |
801
9f2426241f09
reverted accidental removal of sx, sy
Anselm R. Garbe <arg@suckless.org>
parents:
800
diff
changeset
|
19 |
int screen, sx, sy, sw, sh, wax, way, waw, wah; |
988
aea51354bbe6
moved bar-related stuff to bar.c (merged draw.c into that)
Anselm R. Garbe <garbeam@gmail.com>
parents:
987
diff
changeset
|
20 |
unsigned int ntags; |
917
434e10a35d3c
I change the style of init somewhat, init as early as possible.
Anselm R. Garbe <arg@suckless.org>
parents:
914
diff
changeset
|
21 |
unsigned int numlockmask = 0; |
971
b2a0dfa22b1d
removed the _DWM_PROPERTIES handling, reverted ban/unban to XMoveWindow(), and changed argument of setlayout to layout[N].symbol check
Anselm R. Garbe <garbeam@gmail.com>
parents:
969
diff
changeset
|
22 |
Atom wmatom[WMLast], netatom[NetLast]; |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
23 |
Bool *seltags; |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
24 |
Bool selscreen = True; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
25 |
Client *clients = NULL; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
26 |
Client *sel = NULL; |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
27 |
Client *stack = NULL; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
28 |
Cursor cursor[CurLast]; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
29 |
Display *dpy; |
988
aea51354bbe6
moved bar-related stuff to bar.c (merged draw.c into that)
Anselm R. Garbe <garbeam@gmail.com>
parents:
987
diff
changeset
|
30 |
Window root; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
31 |
|
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
32 |
/* static */ |
0 | 33 |
|
123 | 34 |
static int (*xerrorxlib)(Display *, XErrorEvent *); |
302 | 35 |
static Bool otherwm, readin; |
800
6133edf536de
removed some global vars which should be static instead
Anselm R. Garbe <arg@suckless.org>
parents:
795
diff
changeset
|
36 |
static Bool running = True; |
0 | 37 |
|
38 |
static void |
|
487 | 39 |
cleanup(void) { |
302 | 40 |
close(STDIN_FILENO); |
645 | 41 |
while(stack) { |
914
dad36921af06
applied anudots [un]ban repair patch
Anselm R. Garbe <arg@suckless.org>
parents:
910
diff
changeset
|
42 |
unban(stack); |
971
b2a0dfa22b1d
removed the _DWM_PROPERTIES handling, reverted ban/unban to XMoveWindow(), and changed argument of setlayout to layout[N].symbol check
Anselm R. Garbe <garbeam@gmail.com>
parents:
969
diff
changeset
|
43 |
unmanage(stack); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
44 |
} |
295 | 45 |
if(dc.font.set) |
46 |
XFreeFontSet(dpy, dc.font.set); |
|
47 |
else |
|
48 |
XFreeFont(dpy, dc.font.xfont); |
|
292 | 49 |
XUngrabKey(dpy, AnyKey, AnyModifier, root); |
295 | 50 |
XFreePixmap(dpy, dc.drawable); |
51 |
XFreeGC(dpy, dc.gc); |
|
309
204427dcc087
corrected order of cleanup code
Anselm R.Garbe <arg@10ksloc.org>
parents:
302
diff
changeset
|
52 |
XDestroyWindow(dpy, barwin); |
616 | 53 |
XFreeCursor(dpy, cursor[CurNormal]); |
54 |
XFreeCursor(dpy, cursor[CurResize]); |
|
55 |
XFreeCursor(dpy, cursor[CurMove]); |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
56 |
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
292 | 57 |
XSync(dpy, False); |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
58 |
free(seltags); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
59 |
} |
0 | 60 |
|
969
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
61 |
static long |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
62 |
getstate(Window w) { |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
63 |
int format, status; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
64 |
long result = -1; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
65 |
unsigned char *p = NULL; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
66 |
unsigned long n, extra; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
67 |
Atom real; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
68 |
|
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
69 |
status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
70 |
&real, &format, &n, &extra, (unsigned char **)&p); |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
71 |
if(status != Success) |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
72 |
return -1; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
73 |
if(n != 0) |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
74 |
result = *p; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
75 |
XFree(p); |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
76 |
return result; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
77 |
} |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
78 |
|
777
469dc170f833
draw.c is useless (belongs to main.c now)
Anselm R. Garbe <arg@suckless.org>
parents:
770
diff
changeset
|
79 |
static void |
795
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
80 |
scan(void) { |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
81 |
unsigned int i, num; |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
82 |
Window *wins, d1, d2; |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
83 |
XWindowAttributes wa; |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
84 |
|
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
85 |
wins = NULL; |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
86 |
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
87 |
for(i = 0; i < num; i++) { |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
88 |
if(!XGetWindowAttributes(dpy, wins[i], &wa) |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
89 |
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
90 |
continue; |
969
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
91 |
if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState) |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
92 |
manage(wins[i], &wa); |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
93 |
} |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
94 |
for(i = 0; i < num; i++) { /* now the transients */ |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
95 |
if(!XGetWindowAttributes(dpy, wins[i], &wa)) |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
96 |
continue; |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
97 |
if(XGetTransientForHint(dpy, wins[i], &d1) |
50fb50842dbc
fixed misappearance of iconified windows on SIGKILL
Anselm R. Garbe <garbeam@gmail.com>
parents:
968
diff
changeset
|
98 |
&& (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)) |
795
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
99 |
manage(wins[i], &wa); |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
100 |
} |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
101 |
} |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
102 |
if(wins) |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
103 |
XFree(wins); |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
104 |
} |
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
105 |
|
3b23c75920a3
renamed setfont to initfont, getcolor to initcolor
Anselm R. Garbe <arg@suckless.org>
parents:
793
diff
changeset
|
106 |
static void |
487 | 107 |
setup(void) { |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
108 |
int i, j; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
109 |
unsigned int mask; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
110 |
Window w; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
111 |
XModifierKeymap *modmap; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
112 |
XSetWindowAttributes wa; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
113 |
|
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
114 |
/* init atoms */ |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
115 |
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
116 |
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
966
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
117 |
wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False); |
725
d99be681d502
handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
Anselm R. Garbe <arg@suckless.org>
parents:
716
diff
changeset
|
118 |
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
119 |
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
120 |
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
121 |
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
122 |
PropModeReplace, (unsigned char *) netatom, NetLast); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
123 |
/* init cursors */ |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
124 |
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
125 |
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
126 |
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
127 |
/* init modifier map */ |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
128 |
modmap = XGetModifierMapping(dpy); |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
744
diff
changeset
|
129 |
for (i = 0; i < 8; i++) |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
130 |
for (j = 0; j < modmap->max_keypermod; j++) { |
757
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
744
diff
changeset
|
131 |
if(modmap->modifiermap[i * modmap->max_keypermod + j] |
22dfaeb82491
made for/if/else constructs more consistent, some code polishing
Anselm R. Garbe <arg@suckless.org>
parents:
744
diff
changeset
|
132 |
== XKeysymToKeycode(dpy, XK_Num_Lock)) |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
133 |
numlockmask = (1 << i); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
134 |
} |
616 | 135 |
XFreeModifiermap(modmap); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
136 |
/* select for events */ |
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:
458
diff
changeset
|
137 |
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
867
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
865
diff
changeset
|
138 |
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
139 |
wa.cursor = cursor[CurNormal]; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
140 |
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
867
067a7784150e
applied patch of Paul Liu to allow onthefly resizing due to xrandr changes
Anselm R. Garbe <arg@suckless.org>
parents:
865
diff
changeset
|
141 |
XSelectInput(dpy, root, wa.event_mask); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
142 |
grabkeys(); |
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
778
diff
changeset
|
143 |
compileregs(); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
144 |
for(ntags = 0; tags[ntags]; ntags++); |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
145 |
seltags = emallocz(sizeof(Bool) * ntags); |
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
146 |
seltags[0] = True; |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
147 |
/* geometry */ |
801
9f2426241f09
reverted accidental removal of sx, sy
Anselm R. Garbe <arg@suckless.org>
parents:
800
diff
changeset
|
148 |
sx = sy = 0; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
149 |
sw = DisplayWidth(dpy, screen); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
150 |
sh = DisplayHeight(dpy, screen); |
989
5f7018237edb
new colorscheme (16-bit compliant)
Anselm R. Garbe <garbeam@gmail.com>
parents:
988
diff
changeset
|
151 |
initstyle(); |
782
92862ab407d5
introduced Layout struct
Anselm R. Garbe <arg@suckless.org>
parents:
778
diff
changeset
|
152 |
initlayouts(); |
988
aea51354bbe6
moved bar-related stuff to bar.c (merged draw.c into that)
Anselm R. Garbe <garbeam@gmail.com>
parents:
987
diff
changeset
|
153 |
initbar(); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
154 |
/* multihead support */ |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
155 |
selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
156 |
} |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
157 |
|
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
158 |
/* |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
159 |
* Startup Error handler to check if another window manager |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
160 |
* is already running. |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
161 |
*/ |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
162 |
static int |
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:
458
diff
changeset
|
163 |
xerrorstart(Display *dsply, XErrorEvent *ee) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
164 |
otherwm = True; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
165 |
return -1; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
166 |
} |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
167 |
|
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
168 |
/* extern */ |
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
169 |
|
966
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
170 |
Bool |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
171 |
gettextprop(Window w, Atom atom, char *text, unsigned int size) { |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
172 |
char **list = NULL; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
173 |
int n; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
174 |
XTextProperty name; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
175 |
|
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
176 |
if(!text || size == 0) |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
177 |
return False; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
178 |
text[0] = '\0'; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
179 |
XGetTextProperty(dpy, w, &name, atom); |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
180 |
if(!name.nitems) |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
181 |
return False; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
182 |
if(name.encoding == XA_STRING) |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
183 |
strncpy(text, (char *)name.value, size - 1); |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
184 |
else { |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
185 |
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
186 |
&& n > 0 && *list) |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
187 |
{ |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
188 |
strncpy(text, *list, size - 1); |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
189 |
XFreeStringList(list); |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
190 |
} |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
191 |
} |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
192 |
text[size - 1] = '\0'; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
193 |
XFree(name.value); |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
194 |
return True; |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
195 |
} |
3ad7903c9e83
prepared merging layout.c and tag.c into screen.c
Anselm R. Garbe <garbeam@gmail.com>
parents:
964
diff
changeset
|
196 |
|
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
197 |
void |
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:
813
diff
changeset
|
198 |
quit(const char *arg) { |
302 | 199 |
readin = running = False; |
75 | 200 |
} |
201 |
||
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
202 |
/* There's no way to check accesses to destroyed windows, thus those cases are |
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
203 |
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
455
4e3e22673073
fixed some other comments, now also the code side seems to be at a level to be reviewed by experienced programmers
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
204 |
* default error handler, which may call exit. |
0 | 205 |
*/ |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
206 |
int |
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:
458
diff
changeset
|
207 |
xerror(Display *dpy, XErrorEvent *ee) { |
75 | 208 |
if(ee->error_code == BadWindow |
123 | 209 |
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
210 |
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) |
|
211 |
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) |
|
212 |
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) |
|
213 |
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) |
|
458
81fcd7ddafee
applied Christof Musik's multihead patch for a pathologic cornercase
Anselm R. Garbe <arg@10kloc.org>
parents:
455
diff
changeset
|
214 |
|| (ee->request_code == X_GrabKey && ee->error_code == BadAccess) |
81fcd7ddafee
applied Christof Musik's multihead patch for a pathologic cornercase
Anselm R. Garbe <arg@10kloc.org>
parents:
455
diff
changeset
|
215 |
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) |
0 | 216 |
return 0; |
34 | 217 |
fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", |
123 | 218 |
ee->request_code, ee->error_code); |
455
4e3e22673073
fixed some other comments, now also the code side seems to be at a level to be reviewed by experienced programmers
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
219 |
return xerrorxlib(dpy, ee); /* may call exit */ |
27
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
26
diff
changeset
|
220 |
} |
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
26
diff
changeset
|
221 |
|
0 | 222 |
int |
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:
458
diff
changeset
|
223 |
main(int argc, char *argv[]) { |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
580
diff
changeset
|
224 |
char *p; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
225 |
int r, xfd; |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
226 |
fd_set rd; |
778
2ec66bdbb8ad
removed procevent, more refactoring
Anselm R. Garbe <arg@suckless.org>
parents:
777
diff
changeset
|
227 |
XEvent ev; |
0 | 228 |
|
896
9fb6e8e6715b
removed the only one and superfloues strncmp
Anselm R. Garbe <arg@suckless.org>
parents:
886
diff
changeset
|
229 |
if(argc == 2 && !strcmp("-v", argv[1])) |
909
8a8b7a413e66
Jukka also belongs to Copyright holders after all he has contributed and done for dwm, updated -v as well
Anselm R. Garbe <arg@suckless.org>
parents:
907
diff
changeset
|
230 |
eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n"); |
137
77922a389fa8
simplified main.c, switching back to single urxvt usage
arg@10ksloc.org
parents:
126
diff
changeset
|
231 |
else if(argc != 1) |
77922a389fa8
simplified main.c, switching back to single urxvt usage
arg@10ksloc.org
parents:
126
diff
changeset
|
232 |
eprint("usage: dwm [-v]\n"); |
619 | 233 |
setlocale(LC_CTYPE, ""); |
789
3edec0a35000
using eprint instead of fputs
Anselm R. Garbe <arg@suckless.org>
parents:
782
diff
changeset
|
234 |
if(!(dpy = XOpenDisplay(0))) |
197 | 235 |
eprint("dwm: cannot open display\n"); |
265
573b1c4a71a4
reducing ConnectionNumber calls to a bare minimum
Anselm R.Garbe <arg@10ksloc.org>
parents:
262
diff
changeset
|
236 |
xfd = ConnectionNumber(dpy); |
0 | 237 |
screen = DefaultScreen(dpy); |
238 |
root = RootWindow(dpy, screen); |
|
75 | 239 |
otherwm = False; |
240 |
XSetErrorHandler(xerrorstart); |
|
197 | 241 |
/* this causes an error if some other window manager is running */ |
0 | 242 |
XSelectInput(dpy, root, SubstructureRedirectMask); |
78
0d71fb80b592
changing XFlush into XSync
Anselm R. Garbe <garbeam@wmii.de>
parents:
77
diff
changeset
|
243 |
XSync(dpy, False); |
75 | 244 |
if(otherwm) |
245 |
eprint("dwm: another window manager is already running\n"); |
|
0 | 246 |
|
292 | 247 |
XSync(dpy, False); |
78
0d71fb80b592
changing XFlush into XSync
Anselm R. Garbe <garbeam@wmii.de>
parents:
77
diff
changeset
|
248 |
XSetErrorHandler(NULL); |
75 | 249 |
xerrorxlib = XSetErrorHandler(xerror); |
275 | 250 |
XSync(dpy, False); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
251 |
setup(); |
987
ea0cef59c3a3
renamed drawstatus into drawbar
Anselm R. Garbe <garbeam@gmail.com>
parents:
971
diff
changeset
|
252 |
drawbar(); |
75 | 253 |
scan(); |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
254 |
|
214 | 255 |
/* main event loop, also reads status text from stdin */ |
242 | 256 |
XSync(dpy, False); |
302 | 257 |
readin = True; |
5 | 258 |
while(running) { |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
259 |
FD_ZERO(&rd); |
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:
162
diff
changeset
|
260 |
if(readin) |
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:
162
diff
changeset
|
261 |
FD_SET(STDIN_FILENO, &rd); |
265
573b1c4a71a4
reducing ConnectionNumber calls to a bare minimum
Anselm R.Garbe <arg@10ksloc.org>
parents:
262
diff
changeset
|
262 |
FD_SET(xfd, &rd); |
578 | 263 |
if(select(xfd + 1, &rd, NULL, NULL, NULL) == -1) { |
264 |
if(errno == EINTR) |
|
265 |
continue; |
|
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
580
diff
changeset
|
266 |
eprint("select failed\n"); |
578 | 267 |
} |
268 |
if(FD_ISSET(STDIN_FILENO, &rd)) { |
|
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
580
diff
changeset
|
269 |
switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) { |
578 | 270 |
case -1: |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
580
diff
changeset
|
271 |
strncpy(stext, strerror(errno), sizeof stext - 1); |
583
f4285a97e3e6
applied Jukka's patch preventing some cornercases and making the EOF error message correct
arg@mig29
parents:
582
diff
changeset
|
272 |
stext[sizeof stext - 1] = '\0'; |
578 | 273 |
readin = False; |
274 |
break; |
|
275 |
case 0: |
|
583
f4285a97e3e6
applied Jukka's patch preventing some cornercases and making the EOF error message correct
arg@mig29
parents:
582
diff
changeset
|
276 |
strncpy(stext, "EOF", 4); |
578 | 277 |
readin = False; |
278 |
break; |
|
279 |
default: |
|
582 | 280 |
for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0'); |
744
628c5bac7f3b
pneubeck pointed out an obvious thing, that a second p = stext + strlen(stext) - 1 is unnecessary
Anselm R. Garbe <arg@suckless.org>
parents:
740
diff
changeset
|
281 |
for(; p >= stext && *p != '\n'; --p); |
581
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
580
diff
changeset
|
282 |
if(p > stext) |
601842ee4484
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading.
arg@mig29
parents:
580
diff
changeset
|
283 |
strncpy(stext, p + 1, sizeof stext); |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
284 |
} |
987
ea0cef59c3a3
renamed drawstatus into drawbar
Anselm R. Garbe <garbeam@gmail.com>
parents:
971
diff
changeset
|
285 |
drawbar(); |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
286 |
} |
812
8992a53a0d6a
just ignore the FD_ISSET check in main.c of xfd, just call XPending (which does the same afair)
Anselm R. Garbe <arg@suckless.org>
parents:
801
diff
changeset
|
287 |
while(XPending(dpy)) { |
8992a53a0d6a
just ignore the FD_ISSET check in main.c of xfd, just call XPending (which does the same afair)
Anselm R. Garbe <arg@suckless.org>
parents:
801
diff
changeset
|
288 |
XNextEvent(dpy, &ev); |
8992a53a0d6a
just ignore the FD_ISSET check in main.c of xfd, just call XPending (which does the same afair)
Anselm R. Garbe <arg@suckless.org>
parents:
801
diff
changeset
|
289 |
if(handler[ev.type]) |
8992a53a0d6a
just ignore the FD_ISSET check in main.c of xfd, just call XPending (which does the same afair)
Anselm R. Garbe <arg@suckless.org>
parents:
801
diff
changeset
|
290 |
(handler[ev.type])(&ev); /* call handler */ |
8992a53a0d6a
just ignore the FD_ISSET check in main.c of xfd, just call XPending (which does the same afair)
Anselm R. Garbe <arg@suckless.org>
parents:
801
diff
changeset
|
291 |
} |
5 | 292 |
} |
0 | 293 |
cleanup(); |
294 |
XCloseDisplay(dpy); |
|
295 |
return 0; |
|
296 |
} |