-/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
- * See LICENSE file for license details.
- */
+/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
+ * © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
+ * See LICENSE file for license details. */
#include "dwm.h"
#include <stdlib.h>
if(c->isbanned)
XMoveWindow(dpy, c->win, c->x, c->y);
c->isbanned = False;
- if(c->isuntiled)
+ if(c->isfloating)
continue;
c->ismax = False;
nx = wax;
/* extern */
+void
+floating(void) {
+ Client *c;
+
+ for(c = clients; c; c = c->next) {
+ if(isvisible(c)) {
+ if(c->isbanned)
+ XMoveWindow(dpy, c->win, c->x, c->y);
+ c->isbanned = False;
+ resize(c, c->x, c->y, c->w, c->h, True);
+ }
+ else {
+ c->isbanned = True;
+ XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ }
+ }
+ if(!sel || !isvisible(sel)) {
+ for(c = stack; c && !isvisible(c); c = c->snext);
+ focus(c);
+ }
+ restack();
+}
+
void
focusclient(const char *arg) {
Client *c;
if(!sel || !arg)
return;
- switch(atoi(arg)) {
- default:
- return;
- case 1:
- for(c = sel->next; c && !isvisible(c); c = c->next);
- if(!c)
- for(c = clients; c && !isvisible(c); c = c->next);
- break;
- case -1:
+ if(atoi(arg) < 0) {
for(c = sel->prev; c && !isvisible(c); c = c->prev);
if(!c) {
for(c = clients; c && c->next; c = c->next);
for(; c && !isvisible(c); c = c->prev);
}
- break;
+ }
+ else {
+ for(c = sel->next; c && !isvisible(c); c = c->next);
+ if(!c)
+ for(c = clients; c && !isvisible(c); c = c->next);
}
if(c) {
focus(c);
Client *
nexttiled(Client *c) {
- for(; c && (c->isuntiled || !isvisible(c)); c = c->next);
+ for(; c && (c->isfloating || !isvisible(c)); c = c->next);
return c;
}
drawstatus();
if(!sel)
return;
- if(sel->isuntiled || lt->arrange == untile)
+ if(sel->isfloating || lt->arrange == floating)
XRaiseWindow(dpy, sel->win);
- if(lt->arrange != untile) {
- if(!sel->isuntiled)
+ if(lt->arrange != floating) {
+ if(!sel->isfloating)
XLowerWindow(dpy, sel->win);
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
if(c == sel)
togglemax(const char *arg) {
XEvent ev;
- if(!sel || (lt->arrange != untile && !sel->isuntiled) || sel->isfixed)
+ if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
return;
if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x;
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
-void
-untile(void) {
- Client *c;
-
- for(c = clients; c; c = c->next) {
- if(isvisible(c)) {
- if(c->isbanned)
- XMoveWindow(dpy, c->win, c->x, c->y);
- c->isbanned = False;
- resize(c, c->x, c->y, c->w, c->h, True);
- }
- else {
- c->isbanned = True;
- XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
- }
- }
- if(!sel || !isvisible(sel)) {
- for(c = stack; c && !isvisible(c); c = c->snext);
- focus(c);
- }
- restack();
-}
-
void
zoom(const char *arg) {
unsigned int n;
Client *c;
- if(!sel || lt->arrange != tile || sel->isuntiled)
+ if(!sel || lt->arrange != tile || sel->isfloating)
return;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;