changeset: 813:0ed770c96e51
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Thu Feb 22 07:59:13 2007 +0100
summary: several changes, made togglemax extern and separated it from zoom() - moved zoom() and togglemax() into layout.c, changed void (*func)(Arg *) into void (*func)(Arg), changed default keybindings of focusnext/focusprev and incmasterw to h/j/k/l accordingly, made keys in config*h appear alphabetically (special keys first), renamed resizemaster into incmasterw, renamed MASTER into MASTERWIDTH
diff -r 8992a53a0d6a -r 0ed770c96e51 client.c
--- a/client.c Wed Feb 21 21:36:54 2007 +0100
+++ b/client.c Thu Feb 22 07:59:13 2007 +0100
@@ -81,24 +81,6 @@ setclientstate(Client *c, long state) {
XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
PropModeReplace, (unsigned char *)data, 2);
-}
-
-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));
}
static int
@@ -171,7 +153,7 @@ focus(Client *c) {
}
void
-killclient(Arg *arg) {
+killclient(Arg arg) {
if(!sel)
return;
if(isprotodel(sel))
@@ -303,7 +285,7 @@ resize(Client *c, int x, int y, int w, i
}
void
-toggleversatile(Arg *arg) {
+toggleversatile(Arg arg) {
if(!sel || lt->arrange == versatile)
return;
sel->isversatile = !sel->isversatile;
@@ -402,25 +384,3 @@ unmanage(Client *c) {
XUngrabServer(dpy);
lt->arrange();
}
-
-void
-zoom(Arg *arg) {
- unsigned int n;
- Client *c;
-
- if(!sel)
- return;
- if(sel->isversatile || (lt->arrange == versatile)) {
- 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);
- attach(c);
- focus(c);
- lt->arrange();
-}
diff -r 8992a53a0d6a -r 0ed770c96e51 config.arg.h
--- a/config.arg.h Wed Feb 21 21:36:54 2007 +0100
+++ b/config.arg.h Thu Feb 22 07:59:13 2007 +0100
@@ -14,7 +14,6 @@
#define TOPBAR True /* False */
/* behavior */
-#define SNAP 40 /* pixel */
#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define RULES \
@@ -33,27 +32,41 @@ static Layout layout[] = { \
{ "[]=", tile }, /* first entry is default */ \
{ "><>", versatile }, \
};
-#define MASTER 600 /* per thousand */
+#define MASTERWIDTH 600 /* master width per thousand */
#define NMASTER 1 /* clients in master area */
+#define SNAP 40 /* versatile snap pixel */
/* key definitions */
#define MODKEY Mod1Mask
#define KEYS \
static Key key[] = { \
/* modifier key function argument */ \
- { MODKEY|ShiftMask, XK_Return, spawn, \
- { .cmd = "exec urxvtcd -tr -bg '#292929' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" } }, \
+ { MODKEY, XK_Return, zoom, { 0 } }, \
+ { MODKEY, XK_space, setlayout, { .i = -1 } }, \
+ { MODKEY, XK_0, view, { .i = -1 } }, \
+ { MODKEY, XK_1, view, { .i = 0 } }, \
+ { MODKEY, XK_2, view, { .i = 1 } }, \
+ { MODKEY, XK_3, view, { .i = 2 } }, \
+ { MODKEY, XK_4, view, { .i = 3 } }, \
+ { MODKEY, XK_5, view, { .i = 4 } }, \
+ { MODKEY, XK_6, view, { .i = 5 } }, \
+ { MODKEY, XK_7, view, { .i = 6 } }, \
+ { MODKEY, XK_8, view, { .i = 7 } }, \
+ { MODKEY, XK_9, view, { .i = 8 } }, \
+ { MODKEY, XK_d, incnmaster, { .i = -1 } }, \
+ { MODKEY, XK_h, incmasterw, { .i = -15 } }, \
+ { MODKEY, XK_i, incnmaster, { .i = 1 } }, \
+ { MODKEY, XK_j, focusnext, { 0 } }, \
+ { MODKEY, XK_k, focusprev, { 0 } }, \
+ { MODKEY, XK_l, incmasterw, { .i = 15 } }, \
+ { MODKEY, XK_m, togglemax, { 0 } }, \
{ MODKEY, XK_p, spawn, \
{ .cmd = "exe=\"$(lsx `echo $PATH | sed 's/:/ /g'` | sort -u " \
" | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' " \
"-sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"')\" && exec $exe" } }, \
- { MODKEY, XK_j, focusnext, { 0 } }, \
- { MODKEY, XK_k, focusprev, { 0 } }, \
- { MODKEY, XK_Return, zoom, { 0 } }, \
- { MODKEY, XK_g, resizemaster, { .i = 15 } }, \
- { MODKEY, XK_s, resizemaster, { .i = -15 } }, \
- { MODKEY, XK_i, incnmaster, { .i = 1 } }, \
- { MODKEY, XK_d, incnmaster, { .i = -1 } }, \
+ { MODKEY|ShiftMask, XK_Return, spawn, \
+ { .cmd = "exec urxvtcd -tr -bg '#292929' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" } }, \
+ { MODKEY|ShiftMask, XK_space, toggleversatile,{ 0 } }, \
{ MODKEY|ShiftMask, XK_0, tag, { .i = -1 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
@@ -64,6 +77,17 @@ static Key key[] = { \
{ MODKEY|ShiftMask, XK_7, tag, { .i = 6 } }, \
{ MODKEY|ShiftMask, XK_8, tag, { .i = 7 } }, \
{ MODKEY|ShiftMask, XK_9, tag, { .i = 8 } }, \
+ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
+ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
+ { MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
+ { MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
+ { MODKEY|ControlMask, XK_3, toggleview, { .i = 2 } }, \
+ { MODKEY|ControlMask, XK_4, toggleview, { .i = 3 } }, \
+ { MODKEY|ControlMask, XK_5, toggleview, { .i = 4 } }, \
+ { MODKEY|ControlMask, XK_6, toggleview, { .i = 5 } }, \
+ { MODKEY|ControlMask, XK_7, toggleview, { .i = 6 } }, \
+ { MODKEY|ControlMask, XK_8, toggleview, { .i = 7 } }, \
+ { MODKEY|ControlMask, XK_9, toggleview, { .i = 8 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_1, toggletag, { .i = 0 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_2, toggletag, { .i = 1 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_3, toggletag, { .i = 2 } }, \
@@ -73,27 +97,4 @@ static Key key[] = { \
{ MODKEY|ControlMask|ShiftMask, XK_7, toggletag, { .i = 6 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_8, toggletag, { .i = 7 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \
- { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
- { MODKEY, XK_space, setlayout, { .i = -1 } }, \
- { MODKEY|ShiftMask, XK_space, toggleversatile,{ 0 } }, \
- { MODKEY, XK_0, view, { .i = -1 } }, \
- { MODKEY, XK_1, view, { .i = 0 } }, \
- { MODKEY, XK_2, view, { .i = 1 } }, \
- { MODKEY, XK_3, view, { .i = 2 } }, \
- { MODKEY, XK_4, view, { .i = 3 } }, \
- { MODKEY, XK_5, view, { .i = 4 } }, \
- { MODKEY, XK_6, view, { .i = 5 } }, \
- { MODKEY, XK_7, view, { .i = 6 } }, \
- { MODKEY, XK_8, view, { .i = 7 } }, \
- { MODKEY, XK_9, view, { .i = 8 } }, \
- { MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
- { MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
- { MODKEY|ControlMask, XK_3, toggleview, { .i = 2 } }, \
- { MODKEY|ControlMask, XK_4, toggleview, { .i = 3 } }, \
- { MODKEY|ControlMask, XK_5, toggleview, { .i = 4 } }, \
- { MODKEY|ControlMask, XK_6, toggleview, { .i = 5 } }, \
- { MODKEY|ControlMask, XK_7, toggleview, { .i = 6 } }, \
- { MODKEY|ControlMask, XK_8, toggleview, { .i = 7 } }, \
- { MODKEY|ControlMask, XK_9, toggleview, { .i = 8 } }, \
- { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
};
diff -r 8992a53a0d6a -r 0ed770c96e51 config.default.h
--- a/config.default.h Wed Feb 21 21:36:54 2007 +0100
+++ b/config.default.h Thu Feb 22 07:59:13 2007 +0100
@@ -14,7 +14,6 @@
#define TOPBAR True /* False */
/* behavior */
-#define SNAP 20 /* pixel */
#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
/* Query class:instance:title for regex matching info with following command:
@@ -34,22 +33,36 @@ static Layout layout[] = { \
{ "[]=", tile }, /* first entry is default */ \
{ "><>", versatile }, \
};
-#define MASTER 600 /* per thousand */
+#define MASTERWIDTH 600 /* master width per thousand */
#define NMASTER 1 /* clients in master area */
+#define SNAP 20 /* versatile snap pixel */
/* key definitions */
#define MODKEY Mod1Mask
#define KEYS \
static Key key[] = { \
/* modifier key function argument */ \
+ { MODKEY, XK_Return, zoom, { 0 } }, \
+ { MODKEY, XK_space, setlayout, { .i = -1 } }, \
+ { MODKEY, XK_0, view, { .i = -1 } }, \
+ { MODKEY, XK_1, view, { .i = 0 } }, \
+ { MODKEY, XK_2, view, { .i = 1 } }, \
+ { MODKEY, XK_3, view, { .i = 2 } }, \
+ { MODKEY, XK_4, view, { .i = 3 } }, \
+ { MODKEY, XK_5, view, { .i = 4 } }, \
+ { MODKEY, XK_6, view, { .i = 5 } }, \
+ { MODKEY, XK_7, view, { .i = 6 } }, \
+ { MODKEY, XK_8, view, { .i = 7 } }, \
+ { MODKEY, XK_9, view, { .i = 8 } }, \
+ { MODKEY, XK_d, incnmaster, { .i = -1 } }, \
+ { MODKEY, XK_h, incmasterw, { .i = -15 } }, \
+ { MODKEY, XK_i, incnmaster, { .i = 1 } }, \
+ { MODKEY, XK_j, focusnext, { 0 } }, \
+ { MODKEY, XK_k, focusprev, { 0 } }, \
+ { MODKEY, XK_l, incmasterw, { .i = 15 } }, \
+ { MODKEY, XK_m, togglemax, { 0 } }, \
{ MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \
- { MODKEY, XK_Tab, focusnext, { 0 } }, \
- { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
- { MODKEY, XK_Return, zoom, { 0 } }, \
- { MODKEY, XK_g, resizemaster, { .i = 15 } }, \
- { MODKEY, XK_s, resizemaster, { .i = -15 } }, \
- { MODKEY, XK_i, incnmaster, { .i = 1 } }, \
- { MODKEY, XK_d, incnmaster, { .i = -1 } }, \
+ { MODKEY|ShiftMask, XK_space, toggleversatile,{ 0 } }, \
{ MODKEY|ShiftMask, XK_0, tag, { .i = -1 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
@@ -60,6 +73,17 @@ static Key key[] = { \
{ MODKEY|ShiftMask, XK_7, tag, { .i = 6 } }, \
{ MODKEY|ShiftMask, XK_8, tag, { .i = 7 } }, \
{ MODKEY|ShiftMask, XK_9, tag, { .i = 8 } }, \
+ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
+ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
+ { MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
+ { MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
+ { MODKEY|ControlMask, XK_3, toggleview, { .i = 2 } }, \
+ { MODKEY|ControlMask, XK_4, toggleview, { .i = 3 } }, \
+ { MODKEY|ControlMask, XK_5, toggleview, { .i = 4 } }, \
+ { MODKEY|ControlMask, XK_6, toggleview, { .i = 5 } }, \
+ { MODKEY|ControlMask, XK_7, toggleview, { .i = 6 } }, \
+ { MODKEY|ControlMask, XK_8, toggleview, { .i = 7 } }, \
+ { MODKEY|ControlMask, XK_9, toggleview, { .i = 8 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_1, toggletag, { .i = 0 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_2, toggletag, { .i = 1 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_3, toggletag, { .i = 2 } }, \
@@ -69,27 +93,4 @@ static Key key[] = { \
{ MODKEY|ControlMask|ShiftMask, XK_7, toggletag, { .i = 6 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_8, toggletag, { .i = 7 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \
- { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
- { MODKEY, XK_space, setlayout, { .i = -1 } }, \
- { MODKEY|ShiftMask, XK_space, toggleversatile,{ 0 } }, \
- { MODKEY, XK_0, view, { .i = -1 } }, \
- { MODKEY, XK_1, view, { .i = 0 } }, \
- { MODKEY, XK_2, view, { .i = 1 } }, \
- { MODKEY, XK_3, view, { .i = 2 } }, \
- { MODKEY, XK_4, view, { .i = 3 } }, \
- { MODKEY, XK_5, view, { .i = 4 } }, \
- { MODKEY, XK_6, view, { .i = 5 } }, \
- { MODKEY, XK_7, view, { .i = 6 } }, \
- { MODKEY, XK_8, view, { .i = 7 } }, \
- { MODKEY, XK_9, view, { .i = 8 } }, \
- { MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
- { MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
- { MODKEY|ControlMask, XK_3, toggleview, { .i = 2 } }, \
- { MODKEY|ControlMask, XK_4, toggleview, { .i = 3 } }, \
- { MODKEY|ControlMask, XK_5, toggleview, { .i = 4 } }, \
- { MODKEY|ControlMask, XK_6, toggleview, { .i = 5 } }, \
- { MODKEY|ControlMask, XK_7, toggleview, { .i = 6 } }, \
- { MODKEY|ControlMask, XK_8, toggleview, { .i = 7 } }, \
- { MODKEY|ControlMask, XK_9, toggleview, { .i = 8 } }, \
- { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
};
diff -r 8992a53a0d6a -r 0ed770c96e51 dwm.1
--- a/dwm.1 Wed Feb 21 21:36:54 2007 +0100
+++ b/dwm.1 Thu Feb 22 07:59:13 2007 +0100
@@ -60,19 +60,19 @@ Start
Start
.BR xterm (1).
.TP
-.B Mod1-Tab
+.B Mod1-j
Focus next window.
.TP
-.B Mod1-Shift-Tab
+.B Mod1-k
Focus previous window.
.TP
.B Mod1-Return
-Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (versatile layout).
+Zooms/cycles current window to/from master area (tiling layout only).
.TP
-.B Mod1-g
+.B Mod1-l
Grow master area (tiling layout only).
.TP
-.B Mod1-s
+.B Mod1-h
Shrink master area (tiling layout only).
.TP
.B Mod1-i
@@ -80,6 +80,9 @@ Increase the number of windows in the ma
.TP
.B Mod1-d
Decrease the number of windows in the master area (tiling layout only).
+.TP
+.B Mod1-m
+Toggles maximization of current window (versatile layout only).
.TP
.B Mod1-Shift-[1..n]
Apply
@@ -124,7 +127,7 @@ Move current window while dragging (vers
Move current window while dragging (versatile layout only).
.TP
.B Mod1-Button2
-Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (versatile layout).
+Zooms/cycles current window to/from master area (tiling layout only).
.TP
.B Mod1-Button3
Resize current window while dragging (versatile layout only).
diff -r 8992a53a0d6a -r 0ed770c96e51 dwm.h
--- a/dwm.h Wed Feb 21 21:36:54 2007 +0100
+++ b/dwm.h Thu Feb 22 07:59:13 2007 +0100
@@ -90,7 +90,6 @@ extern int screen, sx, sy, sw, sh; /* s
extern int screen, sx, sy, sw, sh; /* screen geometry */
extern int wax, way, wah, waw; /* windowarea geometry */
extern unsigned int bh, blw; /* bar height, bar layout label width */
-extern unsigned int master, nmaster; /* master percent, number of master clients */
extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
extern Atom wmatom[WMLast], netatom[NetLast];
@@ -105,15 +104,14 @@ extern Window root, barwin;
/* client.c */
extern void configure(Client *c); /* send synthetic configure event */
extern void focus(Client *c); /* focus c, c may be NULL */
-extern void killclient(Arg *arg); /* kill c nicely */
+extern void killclient(Arg arg); /* kill c nicely */
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
extern void resize(Client *c, int x, int y,
int w, int h, Bool sizehints); /* resize with given coordinates c*/
-extern void toggleversatile(Arg *arg); /* toggles focused client between versatile/and non-versatile state */
+extern void toggleversatile(Arg arg); /* toggles focused client between versatile/and non-versatile state */
extern void updatesizehints(Client *c); /* update the size hint variables of c */
extern void updatetitle(Client *c); /* update the name of c */
extern void unmanage(Client *c); /* destroy c */
-extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
/* draw.c */
extern void drawstatus(void); /* draw the bar */
@@ -125,18 +123,19 @@ extern void grabkeys(void); /* grab al
extern void grabkeys(void); /* grab all keys defined in config.h */
/* layout.c */
-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 incnmaster(Arg *arg); /* increments nmaster with arg's index value */
+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 incmasterw(Arg arg); /* increments the master width with arg's index value */
+extern void incnmaster(Arg arg); /* increments nmaster with arg's index value */
extern void initlayouts(void); /* initialize layout array */
extern Client *nexttiled(Client *c); /* returns tiled successor of c */
-extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */
extern void restack(void); /* restores z layers of all clients */
-extern void setlayout(Arg *arg); /* sets layout, -1 toggles */
+extern void setlayout(Arg arg); /* sets layout, -1 toggles */
+extern void togglemax(Arg arg); /* toggles maximization of versatile client */
extern void versatile(void); /* arranges all windows versatile */
/* main.c */
-extern void quit(Arg *arg); /* quit dwm nicely */
+extern void quit(Arg arg); /* quit dwm nicely */
extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
@@ -144,13 +143,14 @@ extern void compileregs(void); /* init
extern void compileregs(void); /* initialize regexps of rules defined in config.h */
extern Bool isvisible(Client *c); /* returns True if client is visible */
extern void settags(Client *c, Client *trans); /* sets tags of c */
-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 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 tag(Arg arg); /* tags c with arg's index */
+extern void toggletag(Arg arg); /* toggles c tags with arg's index */
+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 zoom(Arg arg); /* zooms the focused client to master area, arg is ignored */
/* util.c */
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 spawn(Arg *arg); /* forks a new subprocess with arg's cmd */
+extern void spawn(Arg arg); /* forks a new subprocess with arg's cmd */
diff -r 8992a53a0d6a -r 0ed770c96e51 event.c
--- a/event.c Wed Feb 21 21:36:54 2007 +0100
+++ b/event.c Thu Feb 22 07:59:13 2007 +0100
@@ -11,7 +11,7 @@ typedef struct {
typedef struct {
unsigned long mod;
KeySym keysym;
- void (*func)(Arg *arg);
+ void (*func)(Arg arg);
Arg arg;
} Key;
@@ -124,15 +124,15 @@ buttonpress(XEvent *e) {
if(ev->x < x) {
if(ev->button == Button1) {
if(ev->state & MODKEY)
- tag(&a);
+ tag(a);
else
- view(&a);
+ view(a);
}
else if(ev->button == Button3) {
if(ev->state & MODKEY)
- toggletag(&a);
+ toggletag(a);
else
- toggleview(&a);
+ toggleview(a);
}
return;
}
@@ -141,15 +141,15 @@ buttonpress(XEvent *e) {
switch(ev->button) {
case Button1:
a.i = -1;
- setlayout(&a);
+ setlayout(a);
break;
case Button4:
a.i = 1;
- incnmaster(&a);
+ incnmaster(a);
break;
case Button5:
a.i = -1;
- incnmaster(&a);
+ incnmaster(a);
break;
}
}
@@ -162,7 +162,7 @@ buttonpress(XEvent *e) {
movemouse(c);
}
else if(ev->button == Button2)
- zoom(NULL);
+ zoom(a);
else if(ev->button == Button3
&& (lt->arrange == versatile || c->isversatile) && !c->isfixed)
{
@@ -261,7 +261,7 @@ keypress(XEvent *e) {
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
{
if(key[i].func)
- key[i].func(&key[i].arg);
+ key[i].func(key[i].arg);
}
}
diff -r 8992a53a0d6a -r 0ed770c96e51 layout.c
--- a/layout.c Wed Feb 21 21:36:54 2007 +0100
+++ b/layout.c Thu Feb 22 07:59:13 2007 +0100
@@ -3,14 +3,14 @@
*/
#include "dwm.h"
-unsigned int master = MASTER;
-unsigned int nmaster = NMASTER;
unsigned int blw = 0;
Layout *lt = NULL;
/* static */
static unsigned int nlayouts = 0;
+static unsigned int masterw = MASTERWIDTH;
+static unsigned int nmaster = NMASTER;
static void
tile(void) {
@@ -21,7 +21,7 @@ tile(void) {
n++;
/* window geoms */
mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
- mw = (n > nmaster) ? (waw * master) / 1000 : waw;
+ mw = (n > nmaster) ? (waw * masterw) / 1000 : waw;
th = (n > nmaster) ? wah / (n - nmaster) : 0;
tw = waw - mw;
@@ -69,7 +69,7 @@ LAYOUTS
/* extern */
void
-focusnext(Arg *arg) {
+focusnext(Arg arg) {
Client *c;
if(!sel)
@@ -84,7 +84,7 @@ focusnext(Arg *arg) {
}
void
-focusprev(Arg *arg) {
+focusprev(Arg arg) {
Client *c;
if(!sel)
@@ -101,11 +101,26 @@ focusprev(Arg *arg) {
}
void
-incnmaster(Arg *arg) {
- if((lt->arrange != tile) || (nmaster + arg->i < 1)
- || (wah / (nmaster + arg->i) <= 2 * BORDERPX))
- return;
- nmaster += arg->i;
+incmasterw(Arg arg) {
+ if(lt->arrange != tile)
+ return;
+ if(arg.i == 0)
+ masterw = MASTERWIDTH;
+ else {
+ if(waw * (masterw + arg.i) / 1000 >= waw - 2 * BORDERPX
+ || waw * (masterw + arg.i) / 1000 <= 2 * BORDERPX)
+ return;
+ masterw += arg.i;
+ }
+ lt->arrange();
+}
+
+void
+incnmaster(Arg arg) {
+ if((lt->arrange != tile) || (nmaster + arg.i < 1)
+ || (wah / (nmaster + arg.i) <= 2 * BORDERPX))
+ return;
+ nmaster += arg.i;
if(sel)
lt->arrange();
else
@@ -129,21 +144,6 @@ nexttiled(Client *c) {
nexttiled(Client *c) {
for(; c && (c->isversatile || !isvisible(c)); c = c->next);
return c;
-}
-
-void
-resizemaster(Arg *arg) {
- if(lt->arrange != tile)
- 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;
- }
- lt->arrange();
}
void
@@ -170,10 +170,10 @@ restack(void) {
}
void
-setlayout(Arg *arg) {
+setlayout(Arg arg) {
unsigned int i;
- if(arg->i == -1) {
+ if(arg.i == -1) {
for(i = 0; i < nlayouts && lt != &layout[i]; i++);
if(i == nlayouts - 1)
lt = &layout[0];
@@ -181,14 +181,32 @@ setlayout(Arg *arg) {
lt = &layout[++i];
}
else {
- if(arg->i < 0 || arg->i >= nlayouts)
- return;
- lt = &layout[arg->i];
+ if(arg.i < 0 || arg.i >= nlayouts)
+ return;
+ lt = &layout[arg.i];
}
if(sel)
lt->arrange();
else
drawstatus();
+}
+
+void
+togglemax(Arg arg) {
+ XEvent ev;
+
+ if(!sel || !sel->isversatile || sel->isfixed || lt->arrange != versatile)
+ return;
+ if((sel->ismax = !sel->ismax)) {
+ sel->rx = sel->x;
+ sel->ry = sel->y;
+ sel->rw = sel->w;
+ sel->rh = sel->h;
+ resize(sel, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
+ }
+ else
+ resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
void
@@ -213,3 +231,21 @@ versatile(void) {
}
restack();
}
+
+void
+zoom(Arg arg) {
+ unsigned int n;
+ Client *c;
+
+ if(!sel || lt->arrange != tile || sel->isversatile)
+ 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);
+ attach(c);
+ focus(c);
+ lt->arrange();
+}
diff -r 8992a53a0d6a -r 0ed770c96e51 main.c
--- a/main.c Wed Feb 21 21:36:54 2007 +0100
+++ b/main.c Thu Feb 22 07:59:13 2007 +0100
@@ -236,7 +236,7 @@ sendevent(Window w, Atom a, long value)
}
void
-quit(Arg *arg) {
+quit(Arg arg) {
readin = running = False;
}
diff -r 8992a53a0d6a -r 0ed770c96e51 tag.c
--- a/tag.c Wed Feb 21 21:36:54 2007 +0100
+++ b/tag.c Thu Feb 22 07:59:13 2007 +0100
@@ -102,49 +102,49 @@ settags(Client *c, Client *trans) {
}
void
-tag(Arg *arg) {
+tag(Arg arg) {
unsigned int i;
if(!sel)
return;
for(i = 0; i < ntags; i++)
- sel->tags[i] = (arg->i == -1) ? True : False;
- if(arg->i >= 0 && arg->i < ntags)
- sel->tags[arg->i] = True;
+ sel->tags[i] = (arg.i == -1) ? True : False;
+ if(arg.i >= 0 && arg.i < ntags)
+ sel->tags[arg.i] = True;
lt->arrange();
}
void
-toggletag(Arg *arg) {
+toggletag(Arg arg) {
unsigned int i;
if(!sel)
return;
- sel->tags[arg->i] = !sel->tags[arg->i];
+ sel->tags[arg.i] = !sel->tags[arg.i];
for(i = 0; i < ntags && !sel->tags[i]; i++);
if(i == ntags)
- sel->tags[arg->i] = True;
+ sel->tags[arg.i] = True;
lt->arrange();
}
void
-toggleview(Arg *arg) {
+toggleview(Arg arg) {
unsigned int i;
- seltag[arg->i] = !seltag[arg->i];
+ seltag[arg.i] = !seltag[arg.i];
for(i = 0; i < ntags && !seltag[i]; i++);
if(i == ntags)
- seltag[arg->i] = True; /* cannot toggle last view */
+ seltag[arg.i] = True; /* cannot toggle last view */
lt->arrange();
}
void
-view(Arg *arg) {
+view(Arg arg) {
unsigned int i;
for(i = 0; i < ntags; i++)
- seltag[i] = (arg->i == -1) ? True : False;
- if(arg->i >= 0 && arg->i < ntags)
- seltag[arg->i] = True;
+ seltag[i] = (arg.i == -1) ? True : False;
+ if(arg.i >= 0 && arg.i < ntags)
+ seltag[arg.i] = True;
lt->arrange();
}
diff -r 8992a53a0d6a -r 0ed770c96e51 util.c
--- a/util.c Wed Feb 21 21:36:54 2007 +0100
+++ b/util.c Thu Feb 22 07:59:13 2007 +0100
@@ -30,12 +30,12 @@ eprint(const char *errstr, ...) {
}
void
-spawn(Arg *arg) {
+spawn(Arg arg) {
static char *shell = NULL;
if(!shell && !(shell = getenv("SHELL")))
shell = "/bin/sh";
- if(!arg->cmd)
+ if(!arg.cmd)
return;
/* The double-fork construct avoids zombie processes and keeps the code
* clean from stupid signal handlers. */
@@ -44,8 +44,8 @@ spawn(Arg *arg) {
if(dpy)
close(ConnectionNumber(dpy));
setsid();
- execl(shell, shell, "-c", arg->cmd, (char *)NULL);
- fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg->cmd);
+ execl(shell, shell, "-c", arg.cmd, (char *)NULL);
+ fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg.cmd);
perror(" failed");
}
exit(0);
Received on Thu Feb 22 2007 - 07:59:45 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:40 UTC