handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
authorAnselm R. Garbe <arg@suckless.org>
Sun, 28 Jan 2007 20:29:41 +0100
changeset 725 d99be681d502
parent 724 583c0adeee79
child 726 0f91934037b0
handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
client.c
dwm.h
main.c
--- a/client.c	Fri Jan 26 12:41:15 2007 +0100
+++ b/client.c	Sun Jan 28 20:29:41 2007 +0100
@@ -53,6 +53,13 @@
 				GrabModeAsync, GrabModeSync, None, None);
 }
 
+static void
+setclientstate(Client *c, long state) {
+	long data[] = {state, None};
+	XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
+			PropModeReplace, (unsigned char *)data, 2);
+}
+
 static int
 xerrordummy(Display *dsply, XErrorEvent *ee) {
 	return 0;
@@ -169,6 +176,7 @@
 	stack = clients = c;
 	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
 	XMapWindow(dpy, c->win);
+	setclientstate(c, NormalState);
 	if(isvisible(c))
 		focus(c);
 	arrange();
@@ -293,6 +301,7 @@
 		focus(nc);
 	}
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
+	setclientstate(c, WithdrawnState);
 	free(c->tags);
 	free(c);
 	XSync(dpy, False);
--- a/dwm.h	Fri Jan 26 12:41:15 2007 +0100
+++ b/dwm.h	Sun Jan 28 20:29:41 2007 +0100
@@ -40,7 +40,7 @@
 #define PROTODELWIN		1
 
 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
-enum { WMProtocols, WMDelete, WMLast };			/* default atoms */
+enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
 enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
 enum { ColBorder, ColFG, ColBG, ColLast };		/* color */
 
--- a/main.c	Fri Jan 26 12:41:15 2007 +0100
+++ b/main.c	Sun Jan 28 20:29:41 2007 +0100
@@ -92,6 +92,7 @@
 	/* init atoms */
 	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
+	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
 	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
 	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
 	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,