Client *old = sel;
XEvent ev;
- XFlush(dpy);
sel = c;
if(old && old != c)
drawtitle(old);
drawtitle(c);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
- XFlush(dpy);
+ XSync(dpy, False);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
if(!sel)
return;
- if(!(c = getnext(sel->next)))
- c = getnext(clients);
+ if(!(c = getnext(sel->next, tsel)))
+ c = getnext(clients, tsel);
if(c) {
higher(c);
c->revert = sel;
void
manage(Window w, XWindowAttributes *wa)
{
- Client *c, **l;
+ Client *c;
XSetWindowAttributes twa;
Window trans;
settitle(c);
settags(c);
- for(l = &clients; *l; l = &(*l)->next);
- c->next = *l; /* *l == nil */
- *l = c;
+ c->next = clients;
+ clients = c;
+ XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
+ GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
GrabModeAsync, GrabModeSync, None, None);
- if(!c->dofloat)
- c->dofloat = trans
+ if(!c->isfloat)
+ c->isfloat = trans
|| ((c->maxw == c->minw) && (c->maxh == c->minh));
arrange(NULL);
ban(c);
XMapRaised(dpy, c->win);
XMapRaised(dpy, c->title);
+ XSync(dpy, False);
}
}
resize(sel, False);
}
+void
+pop(Client *c)
+{
+ Client **l;
+ for(l = &clients; *l && *l != c; l = &(*l)->next);
+ *l = c->next;
+
+ c->next = clients; /* pop */
+ clients = c;
+ arrange(NULL);
+}
+
void
resize(Client *c, Bool inc)
{
e.above = None;
e.override_redirect = False;
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
- XFlush(dpy);
+ XSync(dpy, False);
}
void
free(c);
- XFlush(dpy);
+ XSync(dpy, False);
XSetErrorHandler(xerror);
XUngrabServer(dpy);
arrange(NULL);
void
zoom(Arg *arg)
{
- Client **l, *c;
+ Client *c;
if(!sel)
return;
- if(sel == getnext(clients) && sel->next) {
- if((c = getnext(sel->next)))
+ if(sel == getnext(clients, tsel) && sel->next) {
+ if((c = getnext(sel->next, tsel)))
sel = c;
}
- for(l = &clients; *l && *l != sel; l = &(*l)->next);
- *l = sel->next;
-
- sel->next = clients; /* pop */
- clients = sel;
- arrange(NULL);
+ pop(sel);
focus(sel);
}