From a5cb80b86cdedb8cd1f3a02de47f204bd174f649 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sun, 28 Jan 2007 20:29:41 +0100 Subject: handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well --- client.c | 9 +++++++++ dwm.h | 2 +- main.c | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index e11abfda..badb8754 100644 --- a/client.c +++ b/client.c @@ -53,6 +53,13 @@ grabbuttons(Client *c, Bool focused) { 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 @@ manage(Window w, XWindowAttributes *wa) { 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 @@ unmanage(Client *c) { focus(nc); } XUngrabButton(dpy, AnyButton, AnyModifier, c->win); + setclientstate(c, WithdrawnState); free(c->tags); free(c); XSync(dpy, False); diff --git a/dwm.h b/dwm.h index e5c623dc..10214282 100644 --- a/dwm.h +++ b/dwm.h @@ -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 */ diff --git a/main.c b/main.c index 9cffafe9..97fdbaf7 100644 --- a/main.c +++ b/main.c @@ -92,6 +92,7 @@ setup(void) { /* 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, -- cgit v1.2.3