summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-28 20:29:41 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-28 20:29:41 +0100
commita5cb80b86cdedb8cd1f3a02de47f204bd174f649 (patch)
tree95ae3939b6ab82281ea076c34ffff73c662eacf5
parentregarding to http://plan9.bell-labs.com/sources/contrib/rsc/man.ps the BUGS s... (diff)
downloaddwm-a5cb80b86cdedb8cd1f3a02de47f204bd174f649.tar.gz
dwm-a5cb80b86cdedb8cd1f3a02de47f204bd174f649.zip
handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
-rw-r--r--client.c9
-rw-r--r--dwm.h2
-rw-r--r--main.c1
3 files changed, 11 insertions, 1 deletions
diff --git a/client.c b/client.c
index e11abfd..badb875 100644
--- a/client.c
+++ b/client.c
@@ -53,6 +53,13 @@ grabbuttons(Client *c, Bool focused) {
53 GrabModeAsync, GrabModeSync, None, None); 53 GrabModeAsync, GrabModeSync, None, None);
54} 54}
55 55
56static void
57setclientstate(Client *c, long state) {
58 long data[] = {state, None};
59 XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
60 PropModeReplace, (unsigned char *)data, 2);
61}
62
56static int 63static int
57xerrordummy(Display *dsply, XErrorEvent *ee) { 64xerrordummy(Display *dsply, XErrorEvent *ee) {
58 return 0; 65 return 0;
@@ -169,6 +176,7 @@ manage(Window w, XWindowAttributes *wa) {
169 stack = clients = c; 176 stack = clients = c;
170 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); 177 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
171 XMapWindow(dpy, c->win); 178 XMapWindow(dpy, c->win);
179 setclientstate(c, NormalState);
172 if(isvisible(c)) 180 if(isvisible(c))
173 focus(c); 181 focus(c);
174 arrange(); 182 arrange();
@@ -293,6 +301,7 @@ unmanage(Client *c) {
293 focus(nc); 301 focus(nc);
294 } 302 }
295 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 303 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
304 setclientstate(c, WithdrawnState);
296 free(c->tags); 305 free(c->tags);
297 free(c); 306 free(c);
298 XSync(dpy, False); 307 XSync(dpy, False);
diff --git a/dwm.h b/dwm.h
index e5c623d..1021428 100644
--- a/dwm.h
+++ b/dwm.h
@@ -40,7 +40,7 @@
40#define PROTODELWIN 1 40#define PROTODELWIN 1
41 41
42enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ 42enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
43enum { WMProtocols, WMDelete, WMLast }; /* default atoms */ 43enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
44enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ 44enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
45enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ 45enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
46 46
diff --git a/main.c b/main.c
index 9cffafe..97fdbaf 100644
--- a/main.c
+++ b/main.c
@@ -92,6 +92,7 @@ setup(void) {
92 /* init atoms */ 92 /* init atoms */
93 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); 93 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
94 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); 94 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
95 wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
95 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); 96 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
96 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); 97 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
97 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, 98 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,