X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=2a981fc8e90b54847018150959669e2aa47b48e3;hb=6475be926bef4916ce632988a2fa408a637babc7;hp=3aae7e0add6d381c9905ef978e01b941a1d14f73;hpb=eb756ee169ad0c94167ff41a9ab2712b348afe4f;p=dwm.git diff --git a/client.c b/client.c index 3aae7e0..2a981fc 100644 --- a/client.c +++ b/client.c @@ -28,17 +28,19 @@ next(Client *c) void zoom(Arg *arg) { - Client **l, *old; + Client **l; - if(!(old = sel)) + if(!sel) return; + if(sel == next(clients)) + sel = next(sel->next); + for(l = &clients; *l && *l != sel; l = &(*l)->next); *l = sel->next; - old->next = clients; /* pop */ - clients = old; - sel = old; + sel->next = clients; /* pop */ + clients = sel; arrange(NULL); focus(sel); } @@ -54,7 +56,6 @@ max(Arg *arg) sel->h = sh - 2 * sel->border - bh; craise(sel); resize(sel, False); - discard_events(EnterWindowMask); } void @@ -117,7 +118,6 @@ floating(Arg *arg) focus(sel); } } - discard_events(EnterWindowMask); } void @@ -168,13 +168,12 @@ tiling(Arg *arg) else ban_client(c); } - if(sel && !sel->tags[tsel]) { + if(!sel || (sel && !sel->tags[tsel])) { if((sel = next(clients))) { craise(sel); focus(sel); } } - discard_events(EnterWindowMask); } void @@ -320,14 +319,16 @@ void focus(Client *c) { Client *old = sel; + XEvent ev; + XFlush(dpy); sel = c; if(old && old != c) draw_client(old); draw_client(c); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); XFlush(dpy); - discard_events(EnterWindowMask); + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } static void