dwm-meillo

changeset 158:4e42dfc0f61f

new resize stuff (using XConfigureWindow instead of XSendEvent)
author arg@10ksloc.org
date Wed, 02 Aug 2006 10:43:21 +0200
parents 93012e947eae
children a5eab6aaf859
files client.c event.c
diffstat 2 files changed, 20 insertions(+), 31 deletions(-) [+]
line diff
     1.1 --- a/client.c	Tue Aug 01 16:44:23 2006 +0200
     1.2 +++ b/client.c	Wed Aug 02 10:43:21 2006 +0200
     1.3 @@ -271,7 +271,7 @@
     1.4  {
     1.5  	int bottom = c->y + c->h;
     1.6  	int right = c->x + c->w;
     1.7 -	XConfigureEvent e;
     1.8 +	XWindowChanges wc;
     1.9  
    1.10  	if(sizehints) {
    1.11  		if(c->incw)
    1.12 @@ -287,30 +287,22 @@
    1.13  		if(c->maxh && c->h > c->maxh)
    1.14  			c->h = c->maxh;
    1.15  	}
    1.16 -	if(c->x > sw) /* might happen on restart */
    1.17 -		c->x = sw - c->w;
    1.18 -	if(c->y > sh)
    1.19 -		c->y = sh - c->h;
    1.20  	if(sticky == TopRight || sticky == BotRight)
    1.21  		c->x = right - c->w;
    1.22  	if(sticky == BotLeft || sticky == BotRight)
    1.23  		c->y = bottom - c->h;
    1.24  
    1.25  	resizetitle(c);
    1.26 -	XSetWindowBorderWidth(dpy, c->win, 1);
    1.27 -	XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
    1.28  
    1.29 -	e.type = ConfigureNotify;
    1.30 -	e.event = c->win;
    1.31 -	e.window = c->win;
    1.32 -	e.x = c->x;
    1.33 -	e.y = c->y;
    1.34 -	e.width = c->w;
    1.35 -	e.height = c->h;
    1.36 -	e.border_width = c->border;
    1.37 -	e.above = None;
    1.38 -	e.override_redirect = False;
    1.39 -	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
    1.40 +	if(c->tags[tsel])
    1.41 +		wc.x = c->x;
    1.42 +	else
    1.43 +		wc.x = c->x + 2 * sw;
    1.44 +	wc.y = c->y;
    1.45 +	wc.width = c->w;
    1.46 +	wc.height = c->h;
    1.47 +	wc.border_width = 1;
    1.48 +	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
    1.49  	XSync(dpy, False);
    1.50  }
    1.51  
     2.1 --- a/event.c	Tue Aug 01 16:44:23 2006 +0200
     2.2 +++ b/event.c	Wed Aug 02 10:43:21 2006 +0200
     2.3 @@ -153,7 +153,6 @@
     2.4  	XConfigureRequestEvent *ev = &e->xconfigurerequest;
     2.5  	XWindowChanges wc;
     2.6  
     2.7 -	ev->value_mask &= ~CWSibling;
     2.8  	if((c = getclient(ev->window))) {
     2.9  		gravitate(c, True);
    2.10  		if(ev->value_mask & CWX)
    2.11 @@ -169,18 +168,16 @@
    2.12  		gravitate(c, False);
    2.13  		resize(c, True, TopLeft);
    2.14  	}
    2.15 -
    2.16 -	wc.x = ev->x;
    2.17 -	wc.y = ev->y;
    2.18 -	wc.width = ev->width;
    2.19 -	wc.height = ev->height;
    2.20 -	wc.border_width = 1;
    2.21 -	wc.sibling = None;
    2.22 -	wc.stack_mode = Above;
    2.23 -	ev->value_mask &= ~CWStackMode;
    2.24 -	ev->value_mask |= CWBorderWidth;
    2.25 -	XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
    2.26 -	XSync(dpy, False);
    2.27 +	else {
    2.28 +		wc.x = ev->x;
    2.29 +		wc.y = ev->y;
    2.30 +		wc.width = ev->width;
    2.31 +		wc.height = ev->height;
    2.32 +		wc.border_width = 1;
    2.33 +		XConfigureWindow(dpy, ev->window,
    2.34 +				CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
    2.35 +		XSync(dpy, False);
    2.36 +	}
    2.37  }
    2.38  
    2.39  static void