dwm-meillo

diff event.c @ 387:dca6aca09653

simplified configurerequest
author Anselm R. Garbe <arg@10kloc.org>
date Tue, 29 Aug 2006 19:24:28 +0200
parents 58288246d16c
children 1da9a6b94ca9
line diff
     1.1 --- a/event.c	Tue Aug 29 18:05:02 2006 +0200
     1.2 +++ b/event.c	Tue Aug 29 19:24:28 2006 +0200
     1.3 @@ -148,27 +148,35 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 +synconfig(Client *c, int x, int y, int w, int h, unsigned int border)
     1.8 +{
     1.9 +	XEvent synev;
    1.10 +
    1.11 +	synev.type = ConfigureNotify;
    1.12 +	synev.xconfigure.display = dpy;
    1.13 +	synev.xconfigure.event = c->win;
    1.14 +	synev.xconfigure.window = c->win;
    1.15 +	synev.xconfigure.x = x;
    1.16 +	synev.xconfigure.y = y;
    1.17 +	synev.xconfigure.width = w;
    1.18 +	synev.xconfigure.height = h;
    1.19 +	synev.xconfigure.border_width = border;
    1.20 +	synev.xconfigure.above = None;
    1.21 +	XSendEvent(dpy, c->win, True, NoEventMask, &synev);
    1.22 +}
    1.23 +
    1.24 +static void
    1.25  configurerequest(XEvent *e)
    1.26  {
    1.27  	unsigned long newmask;
    1.28  	Client *c;
    1.29  	XConfigureRequestEvent *ev = &e->xconfigurerequest;
    1.30 -	XEvent synev;
    1.31  	XWindowChanges wc;
    1.32  
    1.33  	if((c = getclient(ev->window))) {
    1.34  		if(!c->isfloat && (arrange != dofloat) && c->ismax) {
    1.35 -			synev.type = ConfigureNotify;
    1.36 -			synev.xconfigure.display = dpy;
    1.37 -			synev.xconfigure.event = c->win;
    1.38 -			synev.xconfigure.window = c->win;
    1.39 -			synev.xconfigure.x = sx;
    1.40 -			synev.xconfigure.y = sy + bh;
    1.41 -			synev.xconfigure.width = sw - 2;
    1.42 -			synev.xconfigure.height = sw - 2 - bh;
    1.43 -			synev.xconfigure.border_width = ev->border_width;
    1.44 -			synev.xconfigure.above = None;
    1.45 -			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
    1.46 +			synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width);
    1.47 +			XSync(dpy, False);
    1.48  			return;
    1.49  		}
    1.50  		gravitate(c, True);
    1.51 @@ -190,19 +198,8 @@
    1.52  		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
    1.53  		if(newmask)
    1.54  			XConfigureWindow(dpy, c->win, newmask, &wc);
    1.55 -		else {
    1.56 -			synev.type = ConfigureNotify;
    1.57 -			synev.xconfigure.display = dpy;
    1.58 -			synev.xconfigure.event = c->win;
    1.59 -			synev.xconfigure.window = c->win;
    1.60 -			synev.xconfigure.x = c->x;
    1.61 -			synev.xconfigure.y = c->y;
    1.62 -			synev.xconfigure.width = c->w;
    1.63 -			synev.xconfigure.height = c->h;
    1.64 -			synev.xconfigure.border_width = c->border;
    1.65 -			synev.xconfigure.above = None;
    1.66 -			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
    1.67 -		}
    1.68 +		else
    1.69 +			synconfig(c, c->x, c->y, c->w, c->h, c->border);
    1.70  		XSync(dpy, False);
    1.71  		if(c->isfloat)
    1.72  			resize(c, False, TopLeft);