[hackers] [dwm] simplified configurerequest

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Tue Feb 13 13:41:39 2007

changeset: 752:9fe042b02e18
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Tue Feb 13 13:39:33 2007 +0100
summary: simplified configurerequest

diff -r c5f9c2d806e7 -r 9fe042b02e18 client.c
--- a/client.c Mon Feb 12 17:20:51 2007 +0100
+++ b/client.c Tue Feb 13 13:39:33 2007 +0100
@@ -69,19 +69,20 @@ xerrordummy(Display *dsply, XErrorEvent
 
 void
 configure(Client *c) {
- XEvent synev;
-
- 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;
- XSendEvent(dpy, c->win, True, NoEventMask, &synev);
+ XConfigureEvent ce;
+
+ ce.type = ConfigureNotify;
+ ce.display = dpy;
+ ce.event = c->win;
+ ce.window = c->win;
+ ce.x = c->x;
+ ce.y = c->y;
+ ce.width = c->w;
+ ce.height = c->h;
+ ce.border_width = c->border;
+ ce.above = None;
+ ce.override_redirect = False;
+ XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
 }
 
 void
diff -r c5f9c2d806e7 -r 9fe042b02e18 event.c
--- a/event.c Mon Feb 12 17:20:51 2007 +0100
+++ b/event.c Tue Feb 13 13:39:33 2007 +0100
@@ -166,52 +166,33 @@ buttonpress(XEvent *e) {
 
 static void
 configurerequest(XEvent *e) {
- unsigned long newmask;
         Client *c;
         XConfigureRequestEvent *ev = &e->xconfigurerequest;
         XWindowChanges wc;
 
+ 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;
         if((c = getclient(ev->window))) {
                 c->ismax = False;
- 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 = ev->border_width;
- 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
+ if((!c->isfloat && (arrange != dofloat))
+ || ((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))))
+ {
                         configure(c);
- XSync(dpy, False);
- if(c->isfloat) {
- resize(c, False);
- if(!isvisible(c))
- XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
- }
- else
- arrange();
- }
- 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);
- }
+ XSync(dpy, False);
+ return;
+ }
+ }
+ XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
+ if(c && !isvisible(c))
+ XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ XSync(dpy, False);
 }
 
 static void
Received on Tue Feb 13 2007 - 13:41:39 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:16 UTC