X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=8d5ea3064d20fd9600d5c5357c865391d6ed040f;hb=2c0d1cc87bf084ed3f1cdb4be881fb4f64f5773a;hp=8ec8ffb6836c8e69cd0877d68629a87b7b6a8be2;hpb=9fce8215b7c1b95903adbfd0cb7d6e2822ea063f;p=dwm.git diff --git a/client.c b/client.c index 8ec8ffb..8d5ea30 100644 --- a/client.c +++ b/client.c @@ -24,7 +24,7 @@ resizetitle(Client *c) c->tw = c->w + 2; c->tx = c->x + c->w - c->tw + 2; c->ty = c->y; - if(c->tags[tsel]) + if(isvisible(c)) XMoveResizeWindow(dpy, c->title, c->tx, c->ty, c->tw, c->th); else XMoveResizeWindow(dpy, c->title, c->tx + 2 * sw, c->ty, c->tw, c->th); @@ -52,15 +52,12 @@ focus(Client *c) if (!issel) return; Client *old = sel; - XEvent ev; sel = c; if(old && old != c) drawtitle(old); drawtitle(c); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); - XSync(dpy, False); - while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } void @@ -77,8 +74,8 @@ focusnext(Arg *arg) if(!(c = getnext(sel->next))) c = getnext(clients); if(c) { - higher(c); focus(c); + restack(); } } @@ -98,8 +95,8 @@ focusprev(Arg *arg) c = getprev(c); } if(c) { - higher(c); focus(c); + restack(); } } @@ -181,13 +178,6 @@ gravitate(Client *c, Bool invert) } void -higher(Client *c) -{ - XRaiseWindow(dpy, c->win); - XRaiseWindow(dpy, c->title); -} - -void killclient(Arg *arg) { if(!sel) @@ -271,13 +261,12 @@ manage(Window w, XWindowAttributes *wa) || (c->maxw && c->minw && c->maxw == c->minw && c->maxh == c->minh); settitle(c); - arrange(NULL); - /* mapping the window now prevents flicker */ - XMapRaised(dpy, c->win); - XMapRaised(dpy, c->title); - if(c->tags[tsel]) + XMapWindow(dpy, c->win); + XMapWindow(dpy, c->title); + if(isvisible(c)) focus(c); + arrange(NULL); } void @@ -410,7 +399,7 @@ togglemax(Arg *arg) sel->w = sw - 2; sel->h = sh - 2 - bh; - higher(sel); + restack(); resize(sel, arrange == dofloat, TopLeft); sel->x = ox; @@ -438,22 +427,17 @@ unmanage(Client *c) c->next->prev = c->prev; if(c == clients) clients = c->next; - if(sel == c) { - sel = getnext(c->next); - if(!sel) - sel = getprev(c->prev); - if(!sel) - sel = clients; - } + if(sel == c) + sel = getnext(clients); free(c->tags); free(c); XSync(dpy, False); XSetErrorHandler(xerror); XUngrabServer(dpy); - arrange(NULL); if(sel) focus(sel); + arrange(NULL); } void @@ -472,15 +456,13 @@ zoom(Arg *arg) } /* pop */ - if(sel->prev) - sel->prev->next = sel->next; + sel->prev->next = sel->next; if(sel->next) sel->next->prev = sel->prev; sel->prev = NULL; - if(clients) - clients->prev = sel; + clients->prev = sel; sel->next = clients; clients = sel; - arrange(NULL); focus(sel); + arrange(NULL); }