summaryrefslogtreecommitdiffstats
path: root/wm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wm.c50
1 files changed, 4 insertions, 46 deletions
diff --git a/wm.c b/wm.c
index 038e6b9..8c5814f 100644
--- a/wm.c
+++ b/wm.c
@@ -16,11 +16,11 @@
16/* X structs */ 16/* X structs */
17Display *dpy; 17Display *dpy;
18Window root, barwin; 18Window root, barwin;
19Atom wm_atom[WMLast], net_atom[NetLast]; 19Atom net_atom[NetLast];
20Cursor cursor[CurLast]; 20Cursor cursor[CurLast];
21XRectangle rect, barrect; 21XRectangle rect, barrect;
22Bool running = True; 22Bool running = True;
23Client *client = NULL; 23Client *clients = NULL;
24 24
25char *bartext, tag[256]; 25char *bartext, tag[256];
26int screen, sel_screen; 26int screen, sel_screen;
@@ -63,46 +63,6 @@ scan_wins()
63 XFree(wins); 63 XFree(wins);
64} 64}
65 65
66static int
67win_property(Window w, Atom a, Atom t, long l, unsigned char **prop)
68{
69 Atom real;
70 int format;
71 unsigned long res, extra;
72 int status;
73
74 status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
75 &res, &extra, prop);
76
77 if(status != Success || *prop == NULL) {
78 return 0;
79 }
80 if(res == 0)
81 free((void *) *prop);
82 return res;
83}
84
85int
86win_proto(Window w)
87{
88 Atom *protocols;
89 long res;
90 int protos = 0;
91 int i;
92
93 res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L,
94 ((unsigned char **) &protocols));
95 if(res <= 0) {
96 return protos;
97 }
98 for(i = 0; i < res; i++) {
99 if(protocols[i] == wm_atom[WMDelete])
100 protos |= WM_PROTOCOL_DELWIN;
101 }
102 free((char *) protocols);
103 return protos;
104}
105
106/* 66/*
107 * There's no way to check accesses to destroyed windows, thus 67 * There's no way to check accesses to destroyed windows, thus
108 * those cases are ignored (especially on UnmapNotify's). 68 * those cases are ignored (especially on UnmapNotify's).
@@ -201,9 +161,6 @@ main(int argc, char *argv[])
201 x_error_handler = XSetErrorHandler(error_handler); 161 x_error_handler = XSetErrorHandler(error_handler);
202 162
203 /* init atoms */ 163 /* init atoms */
204 wm_atom[WMState] = XInternAtom(dpy, "WM_STATE", False);
205 wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
206 wm_atom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
207 net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 164 net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
208 net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 165 net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
209 166
@@ -242,7 +199,8 @@ main(int argc, char *argv[])
242 XMapRaised(dpy, barwin); 199 XMapRaised(dpy, barwin);
243 draw_bar(); 200 draw_bar();
244 201
245 wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask; 202 wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
203 | LeaveWindowMask;
246 wa.cursor = cursor[CurNormal]; 204 wa.cursor = cursor[CurNormal];
247 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); 205 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
248 206