dwm-meillo

changeset 19:b5510d0c6d43

added basic mouse support (actually we don't need more)
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 21:41:49 +0200
parents 1efa34c6e1b6
children 4560e0882c1d
files client.c event.c mouse.c wm.h
diffstat 4 files changed, 15 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/client.c	Tue Jul 11 21:24:10 2006 +0200
     1.2 +++ b/client.c	Tue Jul 11 21:41:49 2006 +0200
     1.3 @@ -70,8 +70,7 @@
     1.4  	c->r[RFloat].y = wa->y;
     1.5  	c->r[RFloat].width = wa->width;
     1.6  	c->r[RFloat].height = wa->height;
     1.7 -	c->border = wa->border_width;
     1.8 -	XSetWindowBorderWidth(dpy, c->win, 0);
     1.9 +	XSetWindowBorderWidth(dpy, c->win, 1);
    1.10  	XSelectInput(dpy, c->win, CLIENT_MASK);
    1.11  	XGetTransientForHint(dpy, c->win, &c->trans);
    1.12  	if(!XGetWMNormalHints(dpy, c->win, &c->size, &msize) || !c->size.flags)
    1.13 @@ -97,7 +96,11 @@
    1.14  	c->snext = stack;
    1.15  	stack = c;
    1.16  	XMapWindow(dpy, c->win);
    1.17 -	XGrabButton(dpy, AnyButton, Mod1Mask, c->win, False, ButtonPressMask,
    1.18 +	XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
    1.19 +			GrabModeAsync, GrabModeSync, None, None);
    1.20 +	XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
    1.21 +			GrabModeAsync, GrabModeSync, None, None);
    1.22 +	XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
    1.23  			GrabModeAsync, GrabModeSync, None, None);
    1.24  	focus(c);
    1.25  }
    1.26 @@ -116,7 +119,7 @@
    1.27  	e.y = c->r[RFloat].y;
    1.28  	e.width = c->r[RFloat].width;
    1.29  	e.height = c->r[RFloat].height;
    1.30 -	e.border_width = c->border;
    1.31 +	e.border_width = 0;
    1.32  	e.above = None;
    1.33  	e.override_redirect = False;
    1.34  	XSelectInput(dpy, c->win, CLIENT_MASK & ~StructureNotifyMask);
     2.1 --- a/event.c	Tue Jul 11 21:24:10 2006 +0200
     2.2 +++ b/event.c	Tue Jul 11 21:41:49 2006 +0200
     2.3 @@ -86,8 +86,6 @@
     2.4  			c->r[RFloat].width = ev->width;
     2.5  		if(ev->value_mask & CWHeight)
     2.6  			c->r[RFloat].height = ev->height;
     2.7 -		if(ev->value_mask & CWBorderWidth)
     2.8 -			c->border = ev->border_width;
     2.9  	}
    2.10  
    2.11  	wc.x = ev->x;
     3.1 --- a/mouse.c	Tue Jul 11 21:24:10 2006 +0200
     3.2 +++ b/mouse.c	Tue Jul 11 21:41:49 2006 +0200
     3.3 @@ -42,7 +42,7 @@
     3.4  
     3.5  	old_cx = c->r[RFloat].x;
     3.6  	old_cy = c->r[RFloat].y;
     3.7 -	if(XGrabPointer(dpy, c->win, False, MouseMask, GrabModeAsync, GrabModeAsync,
     3.8 +	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
     3.9  				None, cursor[CurResize], CurrentTime) != GrabSuccess)
    3.10  		return;
    3.11  	XGrabServer(dpy);
    3.12 @@ -55,10 +55,12 @@
    3.13  		case MotionNotify:
    3.14  			XUngrabServer(dpy);
    3.15  			mmatch(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y);
    3.16 -			resize(c);
    3.17 +			XResizeWindow(dpy, c->win, c->r[RFloat].width, c->r[RFloat].height);
    3.18  			XGrabServer(dpy);
    3.19  			break;
    3.20  		case ButtonRelease:
    3.21 +			resize(c);
    3.22 +			XUngrabServer(dpy);
    3.23  			XUngrabPointer(dpy, CurrentTime);
    3.24  			return;
    3.25  		}
    3.26 @@ -75,7 +77,7 @@
    3.27  
    3.28  	old_cx = c->r[RFloat].x;
    3.29  	old_cy = c->r[RFloat].y;
    3.30 -	if(XGrabPointer(dpy, c->win, False, MouseMask, GrabModeAsync, GrabModeAsync,
    3.31 +	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
    3.32  				None, cursor[CurMove], CurrentTime) != GrabSuccess)
    3.33  		return;
    3.34  	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
    3.35 @@ -88,10 +90,12 @@
    3.36  			XUngrabServer(dpy);
    3.37  			c->r[RFloat].x = old_cx + (ev.xmotion.x - x1);
    3.38  			c->r[RFloat].y = old_cy + (ev.xmotion.y - y1);
    3.39 -			resize(c);
    3.40 +			XMoveResizeWindow(dpy, c->win, c->r[RFloat].x, c->r[RFloat].y,
    3.41 +					c->r[RFloat].width, c->r[RFloat].height);
    3.42  			XGrabServer(dpy);
    3.43  			break;
    3.44  		case ButtonRelease:
    3.45 +			resize(c);
    3.46  			XUngrabServer(dpy);
    3.47  			XUngrabPointer(dpy, CurrentTime);
    3.48  			return;
     4.1 --- a/wm.h	Tue Jul 11 21:24:10 2006 +0200
     4.2 +++ b/wm.h	Tue Jul 11 21:41:49 2006 +0200
     4.3 @@ -13,19 +13,6 @@
     4.4  
     4.5  typedef struct Client Client;
     4.6  typedef struct Key Key;
     4.7 -typedef enum Align Align;
     4.8 -
     4.9 -enum Align {
    4.10 -	NORTH = 0x01,
    4.11 -	EAST  = 0x02,
    4.12 -	SOUTH = 0x04,
    4.13 -	WEST  = 0x08,
    4.14 -	NEAST = NORTH | EAST,
    4.15 -	NWEST = NORTH | WEST,
    4.16 -	SEAST = SOUTH | EAST,
    4.17 -	SWEST = SOUTH | WEST,
    4.18 -	CENTER = NEAST | SWEST
    4.19 -};
    4.20  
    4.21  /* atoms */
    4.22  enum { WMProtocols, WMDelete, WMLast };
    4.23 @@ -40,7 +27,6 @@
    4.24  struct Client {
    4.25  	char name[256];
    4.26  	char tag[256];
    4.27 -	unsigned int border;
    4.28  	int proto;
    4.29  	Bool fixedsize;
    4.30  	Window win;