aewl

diff event.c @ 164:21071ae1fe68

made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
author arg@10ksloc.org
date Wed, 02 Aug 2006 16:32:05 +0200
parents e2e1de08341d
children e848966a1ac6
line diff
     1.1 --- a/event.c	Wed Aug 02 13:05:04 2006 +0200
     1.2 +++ b/event.c	Wed Aug 02 16:32:05 2006 +0200
     1.3 @@ -3,7 +3,6 @@
     1.4   * See LICENSE file for license details.
     1.5   */
     1.6  #include "dwm.h"
     1.7 -
     1.8  #include <stdlib.h>
     1.9  #include <X11/keysym.h>
    1.10  #include <X11/Xatom.h>
    1.11 @@ -151,32 +150,60 @@
    1.12  {
    1.13  	Client *c;
    1.14  	XConfigureRequestEvent *ev = &e->xconfigurerequest;
    1.15 +	XEvent synev;
    1.16  	XWindowChanges wc;
    1.17 +	unsigned long newmask;
    1.18  
    1.19 -	ev->value_mask &= ~CWSibling;
    1.20  	if((c = getclient(ev->window))) {
    1.21  		gravitate(c, True);
    1.22 -		if(ev->value_mask & CWX)
    1.23 -			c->x = ev->x;
    1.24 -		if(ev->value_mask & CWY)
    1.25 -			c->y = ev->y;
    1.26 -		if(ev->value_mask & CWWidth)
    1.27 -			c->w = ev->width;
    1.28 -		if(ev->value_mask & CWHeight)
    1.29 -			c->h = ev->height;
    1.30 +		if(c->isfloat) {
    1.31 +			if(ev->value_mask & CWX)
    1.32 +				c->x = ev->x;
    1.33 +			if(ev->value_mask & CWY)
    1.34 +				c->y = ev->y;
    1.35 +			if(ev->value_mask & CWWidth)
    1.36 +				c->w = ev->width;
    1.37 +			if(ev->value_mask & CWHeight)
    1.38 +				c->h = ev->height;
    1.39 +		}
    1.40  		if(ev->value_mask & CWBorderWidth)
    1.41 -			c->border = 1;
    1.42 +			c->border = ev->border_width;
    1.43  		gravitate(c, False);
    1.44 +
    1.45  		resize(c, True, TopLeft);
    1.46 +
    1.47 +		wc.x = c->x;
    1.48 +		wc.y = c->y;
    1.49 +		wc.width = c->w;
    1.50 +		wc.height = c->h;
    1.51 +		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
    1.52 +		if(newmask)
    1.53 +			XConfigureWindow(dpy, c->win, newmask, &wc);
    1.54 +		else {
    1.55 +			synev.type = ConfigureNotify;
    1.56 +			synev.xconfigure.display = dpy;
    1.57 +			synev.xconfigure.event = c->win;
    1.58 +			synev.xconfigure.window = c->win;
    1.59 +			synev.xconfigure.x = c->x;
    1.60 +			synev.xconfigure.y = c->y;
    1.61 +			synev.xconfigure.width = c->w;
    1.62 +			synev.xconfigure.height = c->h;
    1.63 +			synev.xconfigure.border_width = c->border;
    1.64 +			synev.xconfigure.above = None;
    1.65 +			/* Send synthetic ConfigureNotify */
    1.66 +			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
    1.67 +		}
    1.68  	}
    1.69 -
    1.70 -	wc.x = ev->x;
    1.71 -	wc.y = ev->y;
    1.72 -	wc.width = ev->width;
    1.73 -	wc.height = ev->height;
    1.74 -	wc.border_width = 1;
    1.75 -	XConfigureWindow(dpy, ev->window,
    1.76 -			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
    1.77 +	else {
    1.78 +		wc.x = ev->x;
    1.79 +		wc.y = ev->y;
    1.80 +		wc.width = ev->width;
    1.81 +		wc.height = ev->height;
    1.82 +		wc.border_width = ev->border_width;
    1.83 +		wc.sibling = ev->above;
    1.84 +		wc.stack_mode = ev->detail;
    1.85 +		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
    1.86 +	}
    1.87  	XSync(dpy, False);
    1.88  }
    1.89