handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well a5cb80b8
Anselm R. Garbe · 2007-01-28 20:29 3 file(s) · +11 −1
client.c +9 −0
53 53
				GrabModeAsync, GrabModeSync, None, None);
54 54
}
55 55
56 +
static void
57 +
setclientstate(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 +
56 63
static int
57 64
xerrordummy(Display *dsply, XErrorEvent *ee) {
58 65
	return 0;
169 176
	stack = clients = c;
170 177
	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
171 178
	XMapWindow(dpy, c->win);
179 +
	setclientstate(c, NormalState);
172 180
	if(isvisible(c))
173 181
		focus(c);
174 182
	arrange();
293 301
		focus(nc);
294 302
	}
295 303
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
304 +
	setclientstate(c, WithdrawnState);
296 305
	free(c->tags);
297 306
	free(c);
298 307
	XSync(dpy, False);
dwm.h +1 −1
40 40
#define PROTODELWIN		1
41 41
42 42
enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
43 -
enum { WMProtocols, WMDelete, WMLast };			/* default atoms */
43 +
enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
44 44
enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
45 45
enum { ColBorder, ColFG, ColBG, ColLast };		/* color */
46 46
main.c +1 −0
92 92
	/* init atoms */
93 93
	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
94 94
	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
95 +
	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
95 96
	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
96 97
	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
97 98
	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,