changeset 532 | 651f2c868b31 |
parent 530 | 451f19d48845 |
child 533 | a5567a0d3011 |
531:96563762b4ad | 532:651f2c868b31 |
---|---|
1 /* |
1 /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
|
3 * See LICENSE file for license details. |
2 * See LICENSE file for license details. |
4 */ |
3 */ |
5 #include "dwm.h" |
4 #include "dwm.h" |
6 #include <stdlib.h> |
5 #include <stdlib.h> |
7 #include <X11/keysym.h> |
6 #include <X11/keysym.h> |
62 XEvent ev; |
61 XEvent ev; |
63 |
62 |
64 ocx = c->x; |
63 ocx = c->x; |
65 ocy = c->y; |
64 ocy = c->y; |
66 if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
65 if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
67 None, cursor[CurResize], CurrentTime) != GrabSuccess) |
66 None, cursor[CurResize], CurrentTime) != GrabSuccess) |
68 return; |
67 return; |
69 c->ismax = False; |
68 c->ismax = False; |
70 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); |
69 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); |
71 for(;;) { |
70 for(;;) { |
72 XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); |
71 XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); |
209 Client *c; |
208 Client *c; |
210 XCrossingEvent *ev = &e->xcrossing; |
209 XCrossingEvent *ev = &e->xcrossing; |
211 |
210 |
212 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
211 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
213 return; |
212 return; |
214 |
|
215 if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) |
213 if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c)) |
216 focus(c); |
214 focus(c); |
217 else if(ev->window == root) { |
215 else if(ev->window == root) { |
218 issel = True; |
216 issel = True; |
219 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
217 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
277 static XWindowAttributes wa; |
275 static XWindowAttributes wa; |
278 XMapRequestEvent *ev = &e->xmaprequest; |
276 XMapRequestEvent *ev = &e->xmaprequest; |
279 |
277 |
280 if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
278 if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
281 return; |
279 return; |
282 |
|
283 if(wa.override_redirect) { |
280 if(wa.override_redirect) { |
284 XSelectInput(dpy, ev->window, |
281 XSelectInput(dpy, ev->window, |
285 (StructureNotifyMask | PropertyChangeMask)); |
282 (StructureNotifyMask | PropertyChangeMask)); |
286 return; |
283 return; |
287 } |
284 } |
288 |
|
289 if(!getclient(ev->window)) |
285 if(!getclient(ev->window)) |
290 manage(ev->window, &wa); |
286 manage(ev->window, &wa); |
291 } |
287 } |
292 |
288 |
293 static void |
289 static void |
296 Window trans; |
292 Window trans; |
297 XPropertyEvent *ev = &e->xproperty; |
293 XPropertyEvent *ev = &e->xproperty; |
298 |
294 |
299 if(ev->state == PropertyDelete) |
295 if(ev->state == PropertyDelete) |
300 return; /* ignore */ |
296 return; /* ignore */ |
301 |
|
302 if((c = getclient(ev->window))) { |
297 if((c = getclient(ev->window))) { |
303 if(ev->atom == wmatom[WMProtocols]) { |
298 if(ev->atom == wmatom[WMProtocols]) { |
304 c->proto = getproto(c->win); |
299 c->proto = getproto(c->win); |
305 return; |
300 return; |
306 } |
301 } |