aewl

changeset 725:d99be681d502

handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
author Anselm R. Garbe <arg@suckless.org>
date Sun, 28 Jan 2007 20:29:41 +0100
parents 583c0adeee79
children 0f91934037b0
files client.c dwm.h main.c
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/client.c	Fri Jan 26 12:41:15 2007 +0100
     1.2 +++ b/client.c	Sun Jan 28 20:29:41 2007 +0100
     1.3 @@ -53,6 +53,13 @@
     1.4  				GrabModeAsync, GrabModeSync, None, None);
     1.5  }
     1.6  
     1.7 +static void
     1.8 +setclientstate(Client *c, long state) {
     1.9 +	long data[] = {state, None};
    1.10 +	XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
    1.11 +			PropModeReplace, (unsigned char *)data, 2);
    1.12 +}
    1.13 +
    1.14  static int
    1.15  xerrordummy(Display *dsply, XErrorEvent *ee) {
    1.16  	return 0;
    1.17 @@ -169,6 +176,7 @@
    1.18  	stack = clients = c;
    1.19  	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    1.20  	XMapWindow(dpy, c->win);
    1.21 +	setclientstate(c, NormalState);
    1.22  	if(isvisible(c))
    1.23  		focus(c);
    1.24  	arrange();
    1.25 @@ -293,6 +301,7 @@
    1.26  		focus(nc);
    1.27  	}
    1.28  	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
    1.29 +	setclientstate(c, WithdrawnState);
    1.30  	free(c->tags);
    1.31  	free(c);
    1.32  	XSync(dpy, False);
     2.1 --- a/dwm.h	Fri Jan 26 12:41:15 2007 +0100
     2.2 +++ b/dwm.h	Sun Jan 28 20:29:41 2007 +0100
     2.3 @@ -40,7 +40,7 @@
     2.4  #define PROTODELWIN		1
     2.5  
     2.6  enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
     2.7 -enum { WMProtocols, WMDelete, WMLast };			/* default atoms */
     2.8 +enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
     2.9  enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
    2.10  enum { ColBorder, ColFG, ColBG, ColLast };		/* color */
    2.11  
     3.1 --- a/main.c	Fri Jan 26 12:41:15 2007 +0100
     3.2 +++ b/main.c	Sun Jan 28 20:29:41 2007 +0100
     3.3 @@ -92,6 +92,7 @@
     3.4  	/* init atoms */
     3.5  	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
     3.6  	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
     3.7 +	wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
     3.8  	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
     3.9  	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
    3.10  	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,