new resize stuff (using XConfigureWindow instead of XSendEvent)

This commit is contained in:
arg@10ksloc.org 2006-08-02 10:43:21 +02:00
parent 080a38d62d
commit 52021851d1
2 changed files with 20 additions and 31 deletions

View File

@ -271,7 +271,7 @@ resize(Client *c, Bool sizehints, Corner sticky)
{ {
int bottom = c->y + c->h; int bottom = c->y + c->h;
int right = c->x + c->w; int right = c->x + c->w;
XConfigureEvent e; XWindowChanges wc;
if(sizehints) { if(sizehints) {
if(c->incw) if(c->incw)
@ -287,30 +287,22 @@ resize(Client *c, Bool sizehints, Corner sticky)
if(c->maxh && c->h > c->maxh) if(c->maxh && c->h > c->maxh)
c->h = c->maxh; c->h = c->maxh;
} }
if(c->x > sw) /* might happen on restart */
c->x = sw - c->w;
if(c->y > sh)
c->y = sh - c->h;
if(sticky == TopRight || sticky == BotRight) if(sticky == TopRight || sticky == BotRight)
c->x = right - c->w; c->x = right - c->w;
if(sticky == BotLeft || sticky == BotRight) if(sticky == BotLeft || sticky == BotRight)
c->y = bottom - c->h; c->y = bottom - c->h;
resizetitle(c); resizetitle(c);
XSetWindowBorderWidth(dpy, c->win, 1);
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
e.type = ConfigureNotify; if(c->tags[tsel])
e.event = c->win; wc.x = c->x;
e.window = c->win; else
e.x = c->x; wc.x = c->x + 2 * sw;
e.y = c->y; wc.y = c->y;
e.width = c->w; wc.width = c->w;
e.height = c->h; wc.height = c->h;
e.border_width = c->border; wc.border_width = 1;
e.above = None; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
e.override_redirect = False;
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
XSync(dpy, False); XSync(dpy, False);
} }

23
event.c
View File

@ -153,7 +153,6 @@ configurerequest(XEvent *e)
XConfigureRequestEvent *ev = &e->xconfigurerequest; XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc; XWindowChanges wc;
ev->value_mask &= ~CWSibling;
if((c = getclient(ev->window))) { if((c = getclient(ev->window))) {
gravitate(c, True); gravitate(c, True);
if(ev->value_mask & CWX) if(ev->value_mask & CWX)
@ -169,18 +168,16 @@ configurerequest(XEvent *e)
gravitate(c, False); gravitate(c, False);
resize(c, True, TopLeft); resize(c, True, TopLeft);
} }
else {
wc.x = ev->x; wc.x = ev->x;
wc.y = ev->y; wc.y = ev->y;
wc.width = ev->width; wc.width = ev->width;
wc.height = ev->height; wc.height = ev->height;
wc.border_width = 1; wc.border_width = 1;
wc.sibling = None; XConfigureWindow(dpy, ev->window,
wc.stack_mode = Above; CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
ev->value_mask &= ~CWStackMode; XSync(dpy, False);
ev->value_mask |= CWBorderWidth; }
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
XSync(dpy, False);
} }
static void static void