if(!sel)
return;
+ if(sel->ismax)
+ togglemax(NULL);
+
if(!(c = getnext(sel->next, tsel)))
c = getnext(clients, tsel);
if(c) {
if(!sel)
return;
+ if(sel->ismax)
+ togglemax(NULL);
+
if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) {
higher(c);
focus(c);
getclient(Window w)
{
Client *c;
+
for(c = clients; c; c = c->next)
if(c->win == w)
return c;
getctitle(Window w)
{
Client *c;
+
for(c = clients; c; c = c->next)
if(c->title == w)
return c;
{
int diff;
Client *c;
- XSetWindowAttributes twa;
Window trans;
+ XSetWindowAttributes twa;
c = emallocz(sizeof(Client));
c->win = w;
c->next = clients;
clients = c;
- XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
- GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button1, MODKEY, c->win, False, ButtonPressMask,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button2, MODKEY, c->win, False, ButtonPressMask,
}
}
-void
-maximize(Arg *arg)
-{
- if(!sel)
- return;
- sel->x = sx;
- sel->y = sy + bh;
- sel->w = sw - 2 * sel->border;
- sel->h = sh - 2 * sel->border - bh;
- higher(sel);
- resize(sel, False, TopLeft);
-}
-
void
pop(Client *c)
{
Client **l;
+
for(l = &clients; *l && *l != c; l = &(*l)->next);
*l = c->next;
void
resize(Client *c, Bool inc, Corner sticky)
{
- XConfigureEvent e;
- int right = c->x + c->w;
int bottom = c->y + c->h;
+ int right = c->x + c->w;
+ XConfigureEvent e;
if(inc) {
if(c->incw)
void
setsize(Client *c)
{
- XSizeHints size;
long msize;
+ XSizeHints size;
+
if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags)
size.flags = PSize;
c->flags = size.flags;
void
settitle(Client *c)
{
- XTextProperty name;
- int n;
char **list = NULL;
+ int n;
+ XTextProperty name;
name.nitems = 0;
c->name[0] = 0;
resizetitle(c);
}
+void
+togglemax(Arg *arg)
+{
+ int ox, oy, ow, oh;
+ XEvent ev;
+
+ if(!sel)
+ return;
+
+ if((sel->ismax = !sel->ismax)) {
+ ox = sel->x;
+ oy = sel->y;
+ ow = sel->w;
+ oh = sel->h;
+ sel->x = sx;
+ sel->y = sy + bh;
+ sel->w = sw - 2 * sel->border;
+ sel->h = sh - 2 * sel->border - bh;
+
+ higher(sel);
+ resize(sel, False, TopLeft);
+
+ sel->x = ox;
+ sel->y = oy;
+ sel->w = ow;
+ sel->h = oh;
+ }
+ else
+ resize(sel, False, TopLeft);
+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
void
unmanage(Client *c)
{