X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=87c2f76a33dfec775274d34f5e04ad5bbf6aaa3e;hb=b4d53bf194f9f9214b6c79d397d723ba53663b4b;hp=33b3c564118d1ee61b4fb9bbda80653043de7434;hpb=28aba061ec2a6fa7923ea00b43e1335a27a73c06;p=dwm.git diff --git a/client.c b/client.c index 33b3c56..87c2f76 100644 --- a/client.c +++ b/client.c @@ -81,6 +81,23 @@ ban(Client *c) { } 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); +} + +void focus(Client *c) { Client *old; @@ -89,8 +106,6 @@ focus(Client *c) { if(!sel) sel = c; else if(sel != c) { - if(maximized) - togglemax(NULL); old = sel; sel = c; if(old) { @@ -301,6 +316,7 @@ resize(Client *c, Bool sizehints, Corner sticky) { else wc.border_width = 1; XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); + configure(c); XSync(dpy, False); } @@ -370,44 +386,10 @@ updatetitle(Client *c) { } void -togglemax(Arg *arg) { - int ox, oy, ow, oh; - Client *c; - XEvent ev; - - if(!sel) - return; - - if((maximized = !maximized)) { - ox = sel->x; - oy = sel->y; - ow = sel->w; - oh = sel->h; - sel->x = sx; - sel->y = sy + bh; - sel->w = sw - 2; - sel->h = sh - 2 - bh; - - restack(); - for(c = getnext(clients); c; c = getnext(c->next)) - if(c != sel) - ban(c); - resize(sel, arrange == dofloat, TopLeft); - - sel->x = ox; - sel->y = oy; - sel->w = ow; - sel->h = oh; - } - else - arrange(NULL); - while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); -} - -void unmanage(Client *c) { Client *nc; + /* The server grab construct avoids race conditions. */ XGrabServer(dpy); XSetErrorHandler(xerrordummy);