about summary refs log tree commit diff stats
path: root/event.c
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
committerarg@10ksloc.org <unknown>2006-08-02 16:32:05 +0200
commit95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6 (patch)
tree98283068f4576b8b2e825dd5eff0eb6e94ddbdc0 /event.c
parenta55f0e12fe5c1205f4d3e40c164fd087224fad7a (diff)
downloaddwm-95e8d12b7189d4cd01b8ae8ecebfa5835a1809e6.tar.gz
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
Diffstat (limited to 'event.c')
-rw-r--r--event.c65
1 files changed, 46 insertions, 19 deletions
diff --git a/event.c b/event.c
index faee103..0c159c7 100644
--- a/event.c
+++ b/event.c
@@ -3,7 +3,6 @@
  * See LICENSE file for license details.
  */
 #include "dwm.h"
-
 #include <stdlib.h>
 #include <X11/keysym.h>
 #include <X11/Xatom.h>
@@ -151,32 +150,60 @@ configurerequest(XEvent *e)
 {
 	Client *c;
 	XConfigureRequestEvent *ev = &e->xconfigurerequest;
+	XEvent synev;
 	XWindowChanges wc;
+	unsigned long newmask;
 
-	ev->value_mask &= ~CWSibling;
 	if((c = getclient(ev->window))) {
 		gravitate(c, True);
-		if(ev->value_mask & CWX)
-			c->x = ev->x;
-		if(ev->value_mask & CWY)
-			c->y = ev->y;
-		if(ev->value_mask & CWWidth)
-			c->w = ev->width;
-		if(ev->value_mask & CWHeight)
-			c->h = ev->height;
+		if(c->isfloat) {
+			if(ev->value_mask & CWX)
+				c->x = ev->x;
+			if(ev->value_mask & CWY)
+				c->y = ev->y;
+			if(ev->value_mask & CWWidth)
+				c->w = ev->width;
+			if(ev->value_mask & CWHeight)
+				c->h = ev->height;
+		}
 		if(ev->value_mask & CWBorderWidth)
-			c->border = 1;
+			c->border = ev->border_width;
 		gravitate(c, False);
+
 		resize(c, True, TopLeft);
-	}
 
-	wc.x = ev->x;
-	wc.y = ev->y;
-	wc.width = ev->width;
-	wc.height = ev->height;
-	wc.border_width = 1;
-	XConfigureWindow(dpy, ev->window,
-			CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+		wc.x = c->x;
+		wc.y = c->y;
+		wc.width = c->w;
+		wc.height = c->h;
+		newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth));
+		if(newmask)
+			XConfigureWindow(dpy, c->win, newmask, &wc);
+		else {
+			synev.type = ConfigureNotify;
+			synev.xconfigure.display = dpy;
+			synev.xconfigure.event = c->win;
+			synev.xconfigure.window = c->win;
+			synev.xconfigure.x = c->x;
+			synev.xconfigure.y = c->y;
+			synev.xconfigure.width = c->w;
+			synev.xconfigure.height = c->h;
+			synev.xconfigure.border_width = c->border;
+			synev.xconfigure.above = None;
+			/* Send synthetic ConfigureNotify */
+			XSendEvent(dpy, c->win, True, NoEventMask, &synev);
+		}
+	}
+	else {
+		wc.x = ev->x;
+		wc.y = ev->y;
+		wc.width = ev->width;
+		wc.height = ev->height;
+		wc.border_width = ev->border_width;
+		wc.sibling = ev->above;
+		wc.stack_mode = ev->detail;
+		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
+	}
 	XSync(dpy, False);
 }