diff options
author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 21:41:49 +0200 |
---|---|---|
committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 21:41:49 +0200 |
commit | 48b6e9a3968e54a87f022c8e68b5bec5423cb75f (patch) | |
tree | 0c2fccdc7b2b18996840e8043bc1a95a1c897f40 | |
parent | b9da4b082eb658b4142b61c149212f414f7653b6 (diff) | |
download | dwm-48b6e9a3968e54a87f022c8e68b5bec5423cb75f.tar dwm-48b6e9a3968e54a87f022c8e68b5bec5423cb75f.tar.gz dwm-48b6e9a3968e54a87f022c8e68b5bec5423cb75f.tar.bz2 |
added basic mouse support (actually we don't need more)
-rw-r--r-- | client.c | 11 | ||||
-rw-r--r-- | event.c | 2 | ||||
-rw-r--r-- | mouse.c | 12 | ||||
-rw-r--r-- | wm.h | 14 |
4 files changed, 15 insertions, 24 deletions
@@ -70,8 +70,7 @@ manage(Window w, XWindowAttributes *wa) c->r[RFloat].y = wa->y; c->r[RFloat].width = wa->width; c->r[RFloat].height = wa->height; - c->border = wa->border_width; - XSetWindowBorderWidth(dpy, c->win, 0); + XSetWindowBorderWidth(dpy, c->win, 1); XSelectInput(dpy, c->win, CLIENT_MASK); XGetTransientForHint(dpy, c->win, &c->trans); if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags) @@ -97,7 +96,11 @@ manage(Window w, XWindowAttributes *wa) c->snext = stack; stack = c; XMapWindow(dpy, c->win); - XGrabButton(dpy, AnyButton, Mod1Mask, c->win, False, ButtonPressMask, + XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask, + GrabModeAsync, GrabModeSync, None, None); + XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask, + GrabModeAsync, GrabModeSync, None, None); + XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, GrabModeAsync, GrabModeSync, None, None); focus(c); } @@ -116,7 +119,7 @@ resize(Client *c) e.y = c->r[RFloat].y; e.width = c->r[RFloat].width; e.height = c->r[RFloat].height; - e.border_width = c->border; + e.border_width = 0; e.above = None; e.override_redirect = False; XSelectInput(dpy, c->win, CLIENT_MASK & ~StructureNotifyMask); @@ -86,8 +86,6 @@ configurerequest(XEvent *e) c->r[RFloat].width = ev->width; if(ev->value_mask & CWHeight) c->r[RFloat].height = ev->height; - if(ev->value_mask & CWBorderWidth) - c->border = ev->border_width; } wc.x = ev->x; @@ -42,7 +42,7 @@ mresize(Client *c) old_cx = c->r[RFloat].x; old_cy = c->r[RFloat].y; - if(XGrabPointer(dpy, c->win, False, MouseMask, GrabModeAsync, GrabModeAsync, + if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, None, cursor[CurResize], CurrentTime) != GrabSuccess) return; XGrabServer(dpy); @@ -55,10 +55,12 @@ mresize(Client *c) case MotionNotify: XUngrabServer(dpy); mmatch(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y); - resize(c); + XResizeWindow(dpy, c->win, c->r[RFloat].width, c->r[RFloat].height); XGrabServer(dpy); break; case ButtonRelease: + resize(c); + XUngrabServer(dpy); XUngrabPointer(dpy, CurrentTime); return; } @@ -75,7 +77,7 @@ mmove(Client *c) old_cx = c->r[RFloat].x; old_cy = c->r[RFloat].y; - if(XGrabPointer(dpy, c->win, False, MouseMask, GrabModeAsync, GrabModeAsync, + if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, None, cursor[CurMove], CurrentTime) != GrabSuccess) return; XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); @@ -88,10 +90,12 @@ mmove(Client *c) XUngrabServer(dpy); c->r[RFloat].x = old_cx + (ev.xmotion.x - x1); c->r[RFloat].y = old_cy + (ev.xmotion.y - y1); - resize(c); + XMoveResizeWindow(dpy, c->win, c->r[RFloat].x, c->r[RFloat].y, + c->r[RFloat].width, c->r[RFloat].height); XGrabServer(dpy); break; case ButtonRelease: + resize(c); XUngrabServer(dpy); XUngrabPointer(dpy, CurrentTime); return; @@ -13,19 +13,6 @@ typedef struct Client Client; typedef struct Key Key; -typedef enum Align Align; - -enum Align { - NORTH = 0x01, - EAST = 0x02, - SOUTH = 0x04, - WEST = 0x08, - NEAST = NORTH | EAST, - NWEST = NORTH | WEST, - SEAST = SOUTH | EAST, - SWEST = SOUTH | WEST, - CENTER = NEAST | SWEST -}; /* atoms */ enum { WMProtocols, WMDelete, WMLast }; @@ -40,7 +27,6 @@ enum { RFloat, RGrid, RLast }; struct Client { char name[256]; char tag[256]; - unsigned int border; int proto; Bool fixedsize; Window win; |