comparison client.c @ 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 d3876aa79292
children 8997e28553a8
comparison
equal deleted inserted replaced
724:583c0adeee79 725:d99be681d502
49 GrabModeAsync, GrabModeSync, None, None); 49 GrabModeAsync, GrabModeSync, None, None);
50 } 50 }
51 else 51 else
52 XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, 52 XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK,
53 GrabModeAsync, GrabModeSync, None, None); 53 GrabModeAsync, GrabModeSync, None, None);
54 }
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);
54 } 61 }
55 62
56 static int 63 static int
57 xerrordummy(Display *dsply, XErrorEvent *ee) { 64 xerrordummy(Display *dsply, XErrorEvent *ee) {
58 return 0; 65 return 0;
167 c->next = clients; 174 c->next = clients;
168 c->snext = stack; 175 c->snext = stack;
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();
175 } 183 }
176 184
291 if(sel == c) { 299 if(sel == c) {
292 for(nc = stack; nc && !isvisible(nc); nc = nc->snext); 300 for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
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);
299 XSetErrorHandler(xerror); 308 XSetErrorHandler(xerror);
300 XUngrabServer(dpy); 309 XUngrabServer(dpy);