introduced tile.c, some refactoring of functions
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -3,7 +3,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
include config.mk
 | 
					include config.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SRC = client.c draw.c event.c main.c tag.c util.c view.c
 | 
					SRC = client.c draw.c event.c main.c tile.c tag.c util.c view.c
 | 
				
			||||||
OBJ = ${SRC:.c=.o}
 | 
					OBJ = ${SRC:.c=.o}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all: options dwm
 | 
					all: options dwm
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,11 +5,11 @@
 | 
				
			|||||||
#define TAGS \
 | 
					#define TAGS \
 | 
				
			||||||
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
 | 
					const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BORDERPX		1
 | 
					 | 
				
			||||||
#define DEFMODE			dotile		/* dofloat */
 | 
					#define DEFMODE			dotile		/* dofloat */
 | 
				
			||||||
#define FLOATSYMBOL		"><>"
 | 
					#define FLOATSYMBOL		"><>"
 | 
				
			||||||
#define TILESYMBOL		"[]="
 | 
					#define TILESYMBOL		"[]="
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define BORDERPX		1
 | 
				
			||||||
#define FONT			"-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*"
 | 
					#define FONT			"-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*"
 | 
				
			||||||
#define NORMBORDERCOLOR		"#333"
 | 
					#define NORMBORDERCOLOR		"#333"
 | 
				
			||||||
#define NORMBGCOLOR		"#222"
 | 
					#define NORMBGCOLOR		"#222"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,11 +5,11 @@
 | 
				
			|||||||
#define TAGS \
 | 
					#define TAGS \
 | 
				
			||||||
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
 | 
					const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BORDERPX		1
 | 
					 | 
				
			||||||
#define DEFMODE			dotile		/* dofloat */
 | 
					#define DEFMODE			dotile		/* dofloat */
 | 
				
			||||||
#define FLOATSYMBOL		"><>"
 | 
					#define FLOATSYMBOL		"><>"
 | 
				
			||||||
#define TILESYMBOL		"[]="
 | 
					#define TILESYMBOL		"[]="
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define BORDERPX		1
 | 
				
			||||||
#define FONT			"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
 | 
					#define FONT			"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
 | 
				
			||||||
#define NORMBORDERCOLOR		"#dddddd"
 | 
					#define NORMBORDERCOLOR		"#dddddd"
 | 
				
			||||||
#define NORMBGCOLOR		"#eeeeee"
 | 
					#define NORMBGCOLOR		"#eeeeee"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								dwm.h
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								dwm.h
									
									
									
									
									
								
							@@ -127,11 +127,17 @@ extern void sendevent(Window w, Atom a, long value);	/* send synthetic event to
 | 
				
			|||||||
extern int xerror(Display *dsply, XErrorEvent *ee);	/* dwm's X error handler */
 | 
					extern int xerror(Display *dsply, XErrorEvent *ee);	/* dwm's X error handler */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* tag.c */
 | 
					/* tag.c */
 | 
				
			||||||
extern void initrregs(void);			/* initialize regexps of rules defined in config.h */
 | 
					extern void compileregexps(void);		/* initialize regexps of rules defined in config.h */
 | 
				
			||||||
extern void settags(Client *c, Client *trans);	/* sets tags of c */
 | 
					extern void settags(Client *c, Client *trans);	/* sets tags of c */
 | 
				
			||||||
extern void tag(Arg *arg);			/* tags c with arg's index */
 | 
					extern void tag(Arg *arg);			/* tags c with arg's index */
 | 
				
			||||||
extern void toggletag(Arg *arg);		/* toggles c tags with arg's index */
 | 
					extern void toggletag(Arg *arg);		/* toggles c tags with arg's index */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* tile.c */
 | 
				
			||||||
 | 
					extern void dotile(void);			/* arranges all windows tiled */
 | 
				
			||||||
 | 
					extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
 | 
				
			||||||
 | 
					extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
 | 
				
			||||||
 | 
					extern void zoom(Arg *arg);			/* zooms the focused client to master area, arg is ignored */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* util.c */
 | 
					/* util.c */
 | 
				
			||||||
extern void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
 | 
					extern void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
 | 
				
			||||||
extern void eprint(const char *errstr, ...);	/* prints errstr and exits with 1 */
 | 
					extern void eprint(const char *errstr, ...);	/* prints errstr and exits with 1 */
 | 
				
			||||||
@@ -140,15 +146,12 @@ extern void spawn(Arg *arg);			/* forks a new subprocess with to arg's cmd */
 | 
				
			|||||||
/* view.c */
 | 
					/* view.c */
 | 
				
			||||||
extern void detach(Client *c);			/* detaches c from global client list */
 | 
					extern void detach(Client *c);			/* detaches c from global client list */
 | 
				
			||||||
extern void dofloat(void);			/* arranges all windows floating */
 | 
					extern void dofloat(void);			/* arranges all windows floating */
 | 
				
			||||||
extern void dotile(void);			/* arranges all windows tiled */
 | 
					 | 
				
			||||||
extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
 | 
					extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
 | 
				
			||||||
extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
 | 
					extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
 | 
				
			||||||
extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
 | 
					 | 
				
			||||||
extern Bool isvisible(Client *c);		/* returns True if client is visible */
 | 
					extern Bool isvisible(Client *c);		/* returns True if client is visible */
 | 
				
			||||||
extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
 | 
					extern Client *nextmanaged(Client *c);		/* returns managed successor of c */
 | 
				
			||||||
extern void restack(void);			/* restores z layers of all clients */
 | 
					extern void restack(void);			/* restores z layers of all clients */
 | 
				
			||||||
extern void togglefloat(Arg *arg);		/* toggles focusesd client between floating/non-floating state */
 | 
					extern void togglefloat(Arg *arg);		/* toggles focusesd client between floating/non-floating state */
 | 
				
			||||||
extern void togglemode(Arg *arg);		/* toggles global arrange function (dotile/dofloat) */
 | 
					extern void togglemode(Arg *arg);		/* toggles global arrange function (dotile/dofloat) */
 | 
				
			||||||
extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */
 | 
					extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */
 | 
				
			||||||
extern void view(Arg *arg);			/* views the tag with arg's index */
 | 
					extern void view(Arg *arg);			/* views the tag with arg's index */
 | 
				
			||||||
extern void zoom(Arg *arg);			/* zooms the focused client to master area, arg is ignored */
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.c
									
									
									
									
									
								
							@@ -117,7 +117,7 @@ setup(void) {
 | 
				
			|||||||
	wa.cursor = cursor[CurNormal];
 | 
						wa.cursor = cursor[CurNormal];
 | 
				
			||||||
	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
 | 
						XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
 | 
				
			||||||
	grabkeys();
 | 
						grabkeys();
 | 
				
			||||||
	initrregs();
 | 
						compileregexps();
 | 
				
			||||||
	for(ntags = 0; tags[ntags]; ntags++);
 | 
						for(ntags = 0; tags[ntags]; ntags++);
 | 
				
			||||||
	seltag = emallocz(sizeof(Bool) * ntags);
 | 
						seltag = emallocz(sizeof(Bool) * ntags);
 | 
				
			||||||
	seltag[0] = True;
 | 
						seltag[0] = True;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								tag.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tag.c
									
									
									
									
									
								
							@@ -32,7 +32,7 @@ static unsigned int len = 0;
 | 
				
			|||||||
/* extern */
 | 
					/* extern */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
initrregs(void) {
 | 
					compileregexps(void) {
 | 
				
			||||||
	unsigned int i;
 | 
						unsigned int i;
 | 
				
			||||||
	regex_t *reg;
 | 
						regex_t *reg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										132
									
								
								tile.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								tile.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,132 @@
 | 
				
			|||||||
 | 
					/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
 | 
				
			||||||
 | 
					 * See LICENSE file for license details.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#include "dwm.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* static */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					togglemax(Client *c) {
 | 
				
			||||||
 | 
						XEvent ev;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						if(c->isfixed)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if((c->ismax = !c->ismax)) {
 | 
				
			||||||
 | 
							c->rx = c->x;
 | 
				
			||||||
 | 
							c->ry = c->y;
 | 
				
			||||||
 | 
							c->rw = c->w;
 | 
				
			||||||
 | 
							c->rh = c->h;
 | 
				
			||||||
 | 
							resize(c, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							resize(c, c->rx, c->ry, c->rw, c->rh, True);
 | 
				
			||||||
 | 
						while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* extern */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					dotile(void) {
 | 
				
			||||||
 | 
						unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
 | 
				
			||||||
 | 
						Client *c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(n = 0, c = nextmanaged(clients); c; c = nextmanaged(c->next))
 | 
				
			||||||
 | 
							n++;
 | 
				
			||||||
 | 
						/* window geoms */
 | 
				
			||||||
 | 
						mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
 | 
				
			||||||
 | 
						mw = (n > nmaster) ? (waw * master) / 1000 : waw;
 | 
				
			||||||
 | 
						th = (n > nmaster) ? wah / (n - nmaster) : 0;
 | 
				
			||||||
 | 
						tw = waw - mw;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(i = 0, c = clients; c; c = c->next)
 | 
				
			||||||
 | 
							if(isvisible(c)) {
 | 
				
			||||||
 | 
								if(c->isbanned)
 | 
				
			||||||
 | 
									XMoveWindow(dpy, c->win, c->x, c->y);
 | 
				
			||||||
 | 
								c->isbanned = False;
 | 
				
			||||||
 | 
								if(c->isfloat)
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								c->ismax = False;
 | 
				
			||||||
 | 
								nx = wax;
 | 
				
			||||||
 | 
								ny = way;
 | 
				
			||||||
 | 
								if(i < nmaster) {
 | 
				
			||||||
 | 
									ny += i * mh;
 | 
				
			||||||
 | 
									nw = mw - 2 * BORDERPX;
 | 
				
			||||||
 | 
									nh = mh - 2 * BORDERPX;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else {  /* tile window */
 | 
				
			||||||
 | 
									nx += mw;
 | 
				
			||||||
 | 
									nw = tw - 2 * BORDERPX;
 | 
				
			||||||
 | 
									if(th > 2 * BORDERPX) {
 | 
				
			||||||
 | 
										ny += (i - nmaster) * th;
 | 
				
			||||||
 | 
										nh = th - 2 * BORDERPX;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else /* fallback if th <= 2 * BORDERPX */
 | 
				
			||||||
 | 
										nh = wah - 2 * BORDERPX;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								resize(c, nx, ny, nw, nh, False);
 | 
				
			||||||
 | 
								i++;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							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
 | 
				
			||||||
 | 
					incnmaster(Arg *arg) {
 | 
				
			||||||
 | 
						if((arrange == dofloat) || (nmaster + arg->i < 1)
 | 
				
			||||||
 | 
						|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						nmaster += arg->i;
 | 
				
			||||||
 | 
						if(sel)
 | 
				
			||||||
 | 
							arrange();
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							drawstatus();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					resizemaster(Arg *arg) {
 | 
				
			||||||
 | 
						if(arrange != dotile)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						if(arg->i == 0)
 | 
				
			||||||
 | 
							master = MASTER;
 | 
				
			||||||
 | 
						else {
 | 
				
			||||||
 | 
							if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
 | 
				
			||||||
 | 
							|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							master += arg->i;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						arrange();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					zoom(Arg *arg) {
 | 
				
			||||||
 | 
						unsigned int n;
 | 
				
			||||||
 | 
						Client *c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(!sel)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						if(sel->isfloat || (arrange == dofloat)) {
 | 
				
			||||||
 | 
							togglemax(sel);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for(n = 0, c = nextmanaged(clients); c; c = nextmanaged(c->next))
 | 
				
			||||||
 | 
							n++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if((c = sel) == nextmanaged(clients))
 | 
				
			||||||
 | 
							if(!(c = nextmanaged(c->next)))
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
						detach(c);
 | 
				
			||||||
 | 
						if(clients)
 | 
				
			||||||
 | 
							clients->prev = c;
 | 
				
			||||||
 | 
						c->next = clients;
 | 
				
			||||||
 | 
						clients = c;
 | 
				
			||||||
 | 
						focus(c);
 | 
				
			||||||
 | 
						arrange();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										136
									
								
								view.c
									
									
									
									
									
								
							
							
						
						
									
										136
									
								
								view.c
									
									
									
									
									
								
							@@ -2,34 +2,6 @@
 | 
				
			|||||||
 * See LICENSE file for license details.
 | 
					 * See LICENSE file for license details.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#include "dwm.h"
 | 
					#include "dwm.h"
 | 
				
			||||||
#include <stdio.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* static */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static Client *
 | 
					 | 
				
			||||||
nexttiled(Client *c) {
 | 
					 | 
				
			||||||
	for(; c && (c->isfloat || !isvisible(c)); c = c->next);
 | 
					 | 
				
			||||||
	return c;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
togglemax(Client *c) {
 | 
					 | 
				
			||||||
	XEvent ev;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	if(c->isfixed)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if((c->ismax = !c->ismax)) {
 | 
					 | 
				
			||||||
		c->rx = c->x;
 | 
					 | 
				
			||||||
		c->ry = c->y;
 | 
					 | 
				
			||||||
		c->rw = c->w;
 | 
					 | 
				
			||||||
		c->rh = c->h;
 | 
					 | 
				
			||||||
		resize(c, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		resize(c, c->rx, c->ry, c->rw, c->rh, True);
 | 
					 | 
				
			||||||
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* extern */
 | 
					/* extern */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -69,58 +41,6 @@ dofloat(void) {
 | 
				
			|||||||
	restack();
 | 
						restack();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
dotile(void) {
 | 
					 | 
				
			||||||
	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
 | 
					 | 
				
			||||||
	Client *c;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
 | 
					 | 
				
			||||||
		n++;
 | 
					 | 
				
			||||||
	/* window geoms */
 | 
					 | 
				
			||||||
	mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
 | 
					 | 
				
			||||||
	mw = (n > nmaster) ? (waw * master) / 1000 : waw;
 | 
					 | 
				
			||||||
	th = (n > nmaster) ? wah / (n - nmaster) : 0;
 | 
					 | 
				
			||||||
	tw = waw - mw;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for(i = 0, c = clients; c; c = c->next)
 | 
					 | 
				
			||||||
		if(isvisible(c)) {
 | 
					 | 
				
			||||||
			if(c->isbanned)
 | 
					 | 
				
			||||||
				XMoveWindow(dpy, c->win, c->x, c->y);
 | 
					 | 
				
			||||||
			c->isbanned = False;
 | 
					 | 
				
			||||||
			if(c->isfloat)
 | 
					 | 
				
			||||||
				continue;
 | 
					 | 
				
			||||||
			c->ismax = False;
 | 
					 | 
				
			||||||
			nx = wax;
 | 
					 | 
				
			||||||
			ny = way;
 | 
					 | 
				
			||||||
			if(i < nmaster) {
 | 
					 | 
				
			||||||
				ny += i * mh;
 | 
					 | 
				
			||||||
				nw = mw - 2 * BORDERPX;
 | 
					 | 
				
			||||||
				nh = mh - 2 * BORDERPX;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			else {  /* tile window */
 | 
					 | 
				
			||||||
				nx += mw;
 | 
					 | 
				
			||||||
				nw = tw - 2 * BORDERPX;
 | 
					 | 
				
			||||||
				if(th > 2 * BORDERPX) {
 | 
					 | 
				
			||||||
					ny += (i - nmaster) * th;
 | 
					 | 
				
			||||||
					nh = th - 2 * BORDERPX;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				else /* fallback if th <= 2 * BORDERPX */
 | 
					 | 
				
			||||||
					nh = wah - 2 * BORDERPX;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			resize(c, nx, ny, nw, nh, False);
 | 
					 | 
				
			||||||
			i++;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		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
 | 
					void
 | 
				
			||||||
focusnext(Arg *arg) {
 | 
					focusnext(Arg *arg) {
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
@@ -153,18 +73,6 @@ focusprev(Arg *arg) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
incnmaster(Arg *arg) {
 | 
					 | 
				
			||||||
	if((arrange == dofloat) || (nmaster + arg->i < 1)
 | 
					 | 
				
			||||||
	|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	nmaster += arg->i;
 | 
					 | 
				
			||||||
	if(sel)
 | 
					 | 
				
			||||||
		arrange();
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		drawstatus();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
isvisible(Client *c) {
 | 
					isvisible(Client *c) {
 | 
				
			||||||
	unsigned int i;
 | 
						unsigned int i;
 | 
				
			||||||
@@ -175,19 +83,10 @@ isvisible(Client *c) {
 | 
				
			|||||||
	return False;
 | 
						return False;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					Client *
 | 
				
			||||||
resizemaster(Arg *arg) {
 | 
					nextmanaged(Client *c) {
 | 
				
			||||||
	if(arrange != dotile)
 | 
						for(; c && (c->isfloat || !isvisible(c)); c = c->next);
 | 
				
			||||||
		return;
 | 
						return c;
 | 
				
			||||||
	if(arg->i == 0)
 | 
					 | 
				
			||||||
		master = MASTER;
 | 
					 | 
				
			||||||
	else {
 | 
					 | 
				
			||||||
		if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
 | 
					 | 
				
			||||||
		|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		master += arg->i;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	arrange();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
@@ -203,7 +102,7 @@ restack(void) {
 | 
				
			|||||||
	if(arrange != dofloat) {
 | 
						if(arrange != dofloat) {
 | 
				
			||||||
		if(!sel->isfloat)
 | 
							if(!sel->isfloat)
 | 
				
			||||||
			XLowerWindow(dpy, sel->win);
 | 
								XLowerWindow(dpy, sel->win);
 | 
				
			||||||
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
 | 
							for(c = nextmanaged(clients); c; c = nextmanaged(c->next)) {
 | 
				
			||||||
			if(c == sel)
 | 
								if(c == sel)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			XLowerWindow(dpy, c->win);
 | 
								XLowerWindow(dpy, c->win);
 | 
				
			||||||
@@ -252,28 +151,3 @@ view(Arg *arg) {
 | 
				
			|||||||
	arrange();
 | 
						arrange();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
zoom(Arg *arg) {
 | 
					 | 
				
			||||||
	unsigned int n;
 | 
					 | 
				
			||||||
	Client *c;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(!sel)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	if(sel->isfloat || (arrange == dofloat)) {
 | 
					 | 
				
			||||||
		togglemax(sel);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
 | 
					 | 
				
			||||||
		n++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if((c = sel) == nexttiled(clients))
 | 
					 | 
				
			||||||
		if(!(c = nexttiled(c->next)))
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
	detach(c);
 | 
					 | 
				
			||||||
	if(clients)
 | 
					 | 
				
			||||||
		clients->prev = c;
 | 
					 | 
				
			||||||
	c->next = clients;
 | 
					 | 
				
			||||||
	clients = c;
 | 
					 | 
				
			||||||
	focus(c);
 | 
					 | 
				
			||||||
	arrange();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user