Mercurial > dwm-meillo
comparison main.c @ 77:38c8f7f7d401
sanitized other stuff
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Sat, 15 Jul 2006 17:19:19 +0200 |
parents | 4bd49f404f10 |
children | 0d71fb80b592 |
comparison
equal
deleted
inserted
replaced
76:4bd49f404f10 | 77:38c8f7f7d401 |
---|---|
14 #include <X11/Xatom.h> | 14 #include <X11/Xatom.h> |
15 #include <X11/Xproto.h> | 15 #include <X11/Xproto.h> |
16 | 16 |
17 Display *dpy; | 17 Display *dpy; |
18 Window root, barwin; | 18 Window root, barwin; |
19 Atom wm_atom[WMLast], net_atom[NetLast]; | 19 Atom wmatom[WMLast], netatom[NetLast]; |
20 Cursor cursor[CurLast]; | 20 Cursor cursor[CurLast]; |
21 Bool running = True; | 21 Bool running = True; |
22 Bool issel; | 22 Bool issel = True; |
23 | 23 |
24 int tsel = Tdev; /* default tag */ | 24 int tsel = Tdev; /* default tag */ |
25 int screen, sx, sy, sw, sh, bx, by, bw, bh, mw; | 25 int screen, sx, sy, sw, sh, bx, by, bw, bh, mw; |
26 char stext[1024]; | 26 char stext[1024]; |
27 | 27 |
28 DC dc = {0}; | 28 DC dc = {0}; |
29 Client *clients = NULL; | 29 Client *clients = NULL; |
30 Client *sel = NULL; | 30 Client *sel = NULL; |
31 | 31 |
32 static Bool otherwm; | 32 static Bool otherwm; |
33 static const char version[] = | |
34 "dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; | |
35 static int (*xerrorxlib)(Display *, XErrorEvent *); | 33 static int (*xerrorxlib)(Display *, XErrorEvent *); |
36 | 34 |
37 /* static functions */ | 35 /* static functions */ |
38 | 36 |
39 static void | 37 static void |
107 unsigned char *protocols; | 105 unsigned char *protocols; |
108 long res; | 106 long res; |
109 int protos = 0; | 107 int protos = 0; |
110 int i; | 108 int i; |
111 | 109 |
112 res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, &protocols); | 110 res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols); |
113 if(res <= 0) { | 111 if(res <= 0) { |
114 return protos; | 112 return protos; |
115 } | 113 } |
116 for(i = 0; i < res; i++) { | 114 for(i = 0; i < res; i++) { |
117 if(protocols[i] == wm_atom[WMDelete]) | 115 if(protocols[i] == wmatom[WMDelete]) |
118 protos |= WM_PROTOCOL_DELWIN; | 116 protos |= WM_PROTOCOL_DELWIN; |
119 } | 117 } |
120 free((char *) protocols); | 118 free((char *) protocols); |
121 return protos; | 119 return protos; |
122 } | 120 } |
182 XEvent ev; | 180 XEvent ev; |
183 | 181 |
184 for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { | 182 for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { |
185 switch (argv[i][1]) { | 183 switch (argv[i][1]) { |
186 case 'v': | 184 case 'v': |
187 fprintf(stdout, "%s", version); | 185 fprintf(stdout, "%s", |
186 "dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n"); | |
188 exit(0); | 187 exit(0); |
189 break; | 188 break; |
190 default: | 189 default: |
191 eprint("usage: dwm [-v]\n"); | 190 eprint("usage: dwm [-v]\n"); |
192 break; | 191 break; |
212 | 211 |
213 XSetErrorHandler(0); | 212 XSetErrorHandler(0); |
214 xerrorxlib = XSetErrorHandler(xerror); | 213 xerrorxlib = XSetErrorHandler(xerror); |
215 | 214 |
216 /* init atoms */ | 215 /* init atoms */ |
217 wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); | 216 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
218 wm_atom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); | 217 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
219 net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); | 218 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
220 net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); | 219 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
221 XChangeProperty(dpy, root, net_atom[NetSupported], XA_ATOM, 32, | 220 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
222 PropModeReplace, (unsigned char *) net_atom, NetLast); | 221 PropModeReplace, (unsigned char *) netatom, NetLast); |
223 | 222 |
224 /* init cursors */ | 223 /* init cursors */ |
225 cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); | 224 cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); |
226 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); | 225 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); |
227 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); | 226 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); |