sander check this
arg@mmvi unknown
Fri, 22 Sep 2006 09:43:21 +0200
1 files changed,
37 insertions(+),
19 deletions(-)
jump to
M
event.c
→
event.c
@@ -21,6 +21,23 @@
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) static void +synconfig(Client *c, int x, int y, int w, int h, unsigned int border) { + XEvent synev; + + synev.type = ConfigureNotify; + synev.xconfigure.display = dpy; + synev.xconfigure.event = c->win; + synev.xconfigure.window = c->win; + synev.xconfigure.x = x; + synev.xconfigure.y = y; + synev.xconfigure.width = w; + synev.xconfigure.height = h; + synev.xconfigure.border_width = border; + synev.xconfigure.above = None; + XSendEvent(dpy, c->win, True, NoEventMask, &synev); +} + +static void movemouse(Client *c) { int x1, y1, ocx, ocy, di; unsigned int dui;@@ -34,10 +51,14 @@ None, cursor[CurMove], CurrentTime) != GrabSuccess)
return; XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); for(;;) { - XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); + XMaskEvent(dpy, MOUSEMASK | ExposureMask | StructureNotifyMask, &ev); switch (ev.type) { default: break; + case ConfigureRequest: + synconfig(c, c->x, c->y, c->w, c->h, ev.xconfigure.border_width); + XSync(dpy, False); + break; case Expose: handler[Expose](&ev); break;@@ -49,6 +70,11 @@ resize(c, False, TopLeft);
break; case ButtonRelease: XUngrabPointer(dpy, CurrentTime); + return; + case DestroyNotify: + case UnmapNotify: + XUngrabPointer(dpy, CurrentTime); + handler[ev.type](&ev); return; } }@@ -68,9 +94,13 @@ None, cursor[CurResize], CurrentTime) != GrabSuccess)
return; XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); for(;;) { - XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); + XMaskEvent(dpy, MOUSEMASK | ExposureMask | StructureNotifyMask, &ev); switch(ev.type) { default: + break; + case ConfigureRequest: + synconfig(c, c->x, c->y, c->w, c->h, ev.xconfigure.border_width); + XSync(dpy, False); break; case Expose: handler[Expose](&ev);@@ -91,6 +121,11 @@ resize(c, True, sticky);
break; case ButtonRelease: XUngrabPointer(dpy, CurrentTime); + return; + case DestroyNotify: + case UnmapNotify: + XUngrabPointer(dpy, CurrentTime); + handler[ev.type](&ev); return; } }@@ -143,23 +178,6 @@ restack(c);
resizemouse(c); } } -} - -static void -synconfig(Client *c, int x, int y, int w, int h, unsigned int border) { - XEvent synev; - - synev.type = ConfigureNotify; - synev.xconfigure.display = dpy; - synev.xconfigure.event = c->win; - synev.xconfigure.window = c->win; - synev.xconfigure.x = x; - synev.xconfigure.y = y; - synev.xconfigure.width = w; - synev.xconfigure.height = h; - synev.xconfigure.border_width = border; - synev.xconfigure.above = None; - XSendEvent(dpy, c->win, True, NoEventMask, &synev); } static void