aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarg@mmvi <unknown>2006-09-22 09:43:21 +0200
committerarg@mmvi <unknown>2006-09-22 09:43:21 +0200
commit9eb226ff78a0d8fc733c31d98170d33824231370 (patch)
treecd947d3c1ba3e577e50f272c1d7f41240e5d5ae8
parente34c4eaf61d4e9972132b53b05cfc43c550d4d15 (diff)
downloaddwm-9eb226ff78a0d8fc733c31d98170d33824231370.tar.gz
sander check this
-rw-r--r--event.c56
1 files changed, 37 insertions, 19 deletions
diff --git a/event.c b/event.c
index d5f4aa8..1939cd5 100644
--- a/event.c
+++ b/event.c
@@ -21,6 +21,23 @@ KEYS
#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 @@ movemouse(Client *c) {
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;
@@ -50,6 +71,11 @@ movemouse(Client *c) {
case ButtonRelease:
XUngrabPointer(dpy, CurrentTime);
return;
+ case DestroyNotify:
+ case UnmapNotify:
+ XUngrabPointer(dpy, CurrentTime);
+ handler[ev.type](&ev);
+ return;
}
}
}
@@ -68,10 +94,14 @@ resizemouse(Client *c) {
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);
break;
@@ -92,6 +122,11 @@ resizemouse(Client *c) {
case ButtonRelease:
XUngrabPointer(dpy, CurrentTime);
return;
+ case DestroyNotify:
+ case UnmapNotify:
+ XUngrabPointer(dpy, CurrentTime);
+ handler[ev.type](&ev);
+ return;
}
}
}
@@ -146,23 +181,6 @@ buttonpress(XEvent *e) {
}
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
configurerequest(XEvent *e) {
unsigned long newmask;
Client *c;