dwm-meillo
changeset 508:ede48935f2b3
added the new dotile as described on ml
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Fri, 29 Sep 2006 16:22:20 +0200 |
parents | 2824b5d0f0f0 |
children | 9dcc64d8a19e |
files | config.arg.h config.default.h dwm.h event.c main.c view.c |
diffstat | 6 files changed, 112 insertions(+), 36 deletions(-) [+] |
line diff
1.1 --- a/config.arg.h Fri Sep 29 14:39:03 2006 +0200 1.2 +++ b/config.arg.h Fri Sep 29 16:22:20 2006 +0200 1.3 @@ -36,6 +36,8 @@ 1.4 { MODKEY, XK_j, focusnext, { 0 } }, \ 1.5 { MODKEY, XK_k, focusprev, { 0 } }, \ 1.6 { MODKEY, XK_Return, zoom, { 0 } }, \ 1.7 + { MODKEY, XK_b, togglestackpos, { 0 } }, \ 1.8 + { MODKEY, XK_d, togglestackdir, { 0 } }, \ 1.9 { MODKEY, XK_g, resizecol, { .i = 20 } }, \ 1.10 { MODKEY, XK_s, resizecol, { .i = -20 } }, \ 1.11 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
2.1 --- a/config.default.h Fri Sep 29 14:39:03 2006 +0200 2.2 +++ b/config.default.h Fri Sep 29 16:22:20 2006 +0200 2.3 @@ -30,6 +30,8 @@ 2.4 { MODKEY, XK_Tab, focusnext, { 0 } }, \ 2.5 { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ 2.6 { MODKEY, XK_Return, zoom, { 0 } }, \ 2.7 + { MODKEY, XK_b, togglestackpos, { 0 } }, \ 2.8 + { MODKEY, XK_d, togglestackdir, { 0 } }, \ 2.9 { MODKEY, XK_g, resizecol, { .i = 20 } }, \ 2.10 { MODKEY, XK_s, resizecol, { .i = -20 } }, \ 2.11 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
3.1 --- a/dwm.h Fri Sep 29 14:39:03 2006 +0200 3.2 +++ b/dwm.h Fri Sep 29 16:22:20 2006 +0200 3.3 @@ -102,7 +102,7 @@ 3.4 extern const char *tags[]; /* all tags */ 3.5 extern char stext[1024]; /* status text */ 3.6 extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ 3.7 -extern int master, screen, sx, sy, sw, sh; /* screen geometry, master width */ 3.8 +extern int master, screen, sx, sy, sw, sh; /* screen geometry, master dimension*/ 3.9 extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ 3.10 extern void (*handler[LASTEvent])(XEvent *); /* event handler */ 3.11 extern void (*arrange)(Arg *); /* arrange function, indicates mode */ 3.12 @@ -170,10 +170,13 @@ 3.13 extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ 3.14 extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ 3.15 extern Bool isvisible(Client *c); /* returns True if client is visible */ 3.16 -extern void resizecol(Arg *arg); /* resizes the master width with arg's index value */ 3.17 +extern void resizecol(Arg *arg); /* resizes the master dimension with arg's index value */ 3.18 extern void restack(void); /* restores z layers of all clients */ 3.19 +extern void togglestackdir(Arg *arg); /* toggles stack direction */ 3.20 +extern void togglestackpos(Arg *arg); /* toggles stack position */ 3.21 extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */ 3.22 extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ 3.23 +extern void updatemaster(void); /* updates master dimension */ 3.24 extern void view(Arg *arg); /* views the tag with arg's index */ 3.25 extern void viewall(Arg *arg); /* views all tags, arg is ignored */ 3.26 -extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */ 3.27 +extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
4.1 --- a/event.c Fri Sep 29 14:39:03 2006 +0200 4.2 +++ b/event.c Fri Sep 29 16:22:20 2006 +0200 4.3 @@ -177,8 +177,9 @@ 4.4 configure(c); 4.5 XSync(dpy, False); 4.6 if(c->isfloat) { 4.7 - if(isvisible(c)) 4.8 - resize(c, False, TopLeft); 4.9 + resize(c, False, TopLeft); 4.10 + if(!isvisible(c)) 4.11 + ban(c); 4.12 } 4.13 else 4.14 arrange(NULL);
5.1 --- a/main.c Fri Sep 29 14:39:03 2006 +0200 5.2 +++ b/main.c Fri Sep 29 16:22:20 2006 +0200 5.3 @@ -133,7 +133,7 @@ 5.4 sx = sy = 0; 5.5 sw = DisplayWidth(dpy, screen); 5.6 sh = DisplayHeight(dpy, screen); 5.7 - master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; 5.8 + updatemaster(); 5.9 5.10 bx = by = 0; 5.11 bw = sw;
6.1 --- a/view.c Fri Sep 29 14:39:03 2006 +0200 6.2 +++ b/view.c Fri Sep 29 16:22:20 2006 +0200 6.3 @@ -148,52 +148,93 @@ 6.4 c->h = sh - 2 * BORDERPX - bh; 6.5 } 6.6 else if(i == 0) { /* master window */ 6.7 - c->x = sx; 6.8 - if(stackpos == StackLeft) 6.9 - c->x += master; 6.10 - c->y = sy + bh; 6.11 - if(isvertical) { 6.12 + switch(stackpos) { 6.13 + case StackLeft: 6.14 + c->x = sx + stackw; 6.15 + c->y = sy + bh; 6.16 c->w = master - 2 * BORDERPX; 6.17 - c->h = sh - 2 * BORDERPX - bh; 6.18 - } 6.19 - else { 6.20 - c->w = sw; 6.21 + c->h = sh - bh - 2 * BORDERPX; 6.22 + break; 6.23 + case StackBottom: 6.24 + c->x = sx; 6.25 + c->y = sy + bh; 6.26 + c->w = sw - 2 * BORDERPX; 6.27 c->h = master - 2 * BORDERPX; 6.28 + break; 6.29 + case StackRight: 6.30 + c->x = sx; 6.31 + c->y = sy + bh; 6.32 + c->w = master - 2 * BORDERPX; 6.33 + c->h = sh - bh - 2 * BORDERPX; 6.34 + break; 6.35 } 6.36 } 6.37 else if((isvertical && th > bh) || (!isvertical && tw > MINW)) { 6.38 /* tile window */ 6.39 - c->x = sx; 6.40 - if(isvertical) 6.41 - c->y = sy + (i - 1) * th + bh; 6.42 - else 6.43 - c->y = sy + bh; 6.44 - if(stackpos == StackRight) 6.45 - c->x += master; 6.46 - else if(stackpos == StackBottom) 6.47 - c->y += master; 6.48 c->w = tw - 2 * BORDERPX; 6.49 c->h = th - 2 * BORDERPX; 6.50 - if(i + 1 == n) { /* fixes for last tile to take up rest space */ 6.51 - if(isvertical) 6.52 - c->h = sh - c->y - 2 * BORDERPX; 6.53 + switch(stackpos) { 6.54 + case StackLeft: 6.55 + if(isvertical) { 6.56 + c->x = sx; 6.57 + c->y = sy + (i - 1) * th + bh; 6.58 + if(i + 1 == n) 6.59 + c->h = sh - c->y - 2 * BORDERPX; 6.60 + } 6.61 else { 6.62 - if(stackpos == StackLeft) 6.63 - c->w = master - c->x - 2 * BORDERPX; 6.64 - else 6.65 + c->x = sx + (i - 1) * tw; 6.66 + c->y = sy + bh; 6.67 + if(i + 1 == n) 6.68 + c->w = sx + stackw - c->x - 2 * BORDERPX; 6.69 + } 6.70 + break; 6.71 + case StackBottom: 6.72 + if(isvertical) { 6.73 + c->x = sx; 6.74 + c->y = sy + master + (i - 1) * th + bh; 6.75 + if(i + 1 == n) 6.76 + c->h = sh - c->y - 2 * BORDERPX; 6.77 + } 6.78 + else { 6.79 + c->x = sx + (i - 1) * tw; 6.80 + c->y = sy + bh + master; 6.81 + if(i + 1 == n) 6.82 c->w = sw - c->x - 2 * BORDERPX; 6.83 } 6.84 + break; 6.85 + case StackRight: 6.86 + if(isvertical) { 6.87 + c->x = sx + master; 6.88 + c->y = sy + (i - 1) * th + bh; 6.89 + if(i + 1 == n) 6.90 + c->h = sh - c->y - 2 * BORDERPX; 6.91 + } 6.92 + else { 6.93 + c->x = sx + master + (i - 1) * tw; 6.94 + c->y = sy + bh; 6.95 + if(i + 1 == n) 6.96 + c->w = sx + stackw - c->x - 2 * BORDERPX; 6.97 + } 6.98 + break; 6.99 } 6.100 } 6.101 else { /* fallback if th < bh resp. tw < MINW */ 6.102 - c->x = sx; 6.103 - c->y = sy + bh; 6.104 - if(stackpos == StackRight) 6.105 - c->x += master; 6.106 - else if(stackpos == StackBottom) 6.107 - c->y += master; 6.108 c->w = stackw - 2 * BORDERPX; 6.109 c->h = stackh - 2 * BORDERPX; 6.110 + switch(stackpos) { 6.111 + case StackLeft: 6.112 + c->x = sx; 6.113 + c->y = sy + bh; 6.114 + break; 6.115 + case StackBottom: 6.116 + c->x = sx; 6.117 + c->y = sy + master; 6.118 + break; 6.119 + case StackRight: 6.120 + c->x = sx + master; 6.121 + c->y = sy + bh; 6.122 + break; 6.123 + } 6.124 } 6.125 resize(c, False, TopLeft); 6.126 i++; 6.127 @@ -319,6 +360,31 @@ 6.128 } 6.129 6.130 void 6.131 +togglestackdir(Arg *arg) { 6.132 + if(arrange == dofloat) 6.133 + return; 6.134 + isvertical = !isvertical; 6.135 + arrange(NULL); 6.136 +} 6.137 + 6.138 +void 6.139 +togglestackpos(Arg *arg) { 6.140 + if(arrange == dofloat) 6.141 + return; 6.142 + if(stackpos == StackBottom) 6.143 + stackpos = STACKPOS; 6.144 + else 6.145 + stackpos = StackBottom; 6.146 + updatemaster(); 6.147 + arrange(NULL); 6.148 +} 6.149 + 6.150 +void 6.151 +updatemaster(void) { 6.152 + master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; 6.153 +} 6.154 + 6.155 +void 6.156 view(Arg *arg) { 6.157 unsigned int i; 6.158 6.159 @@ -339,6 +405,8 @@ 6.160 arrange(NULL); 6.161 } 6.162 6.163 + 6.164 + 6.165 void 6.166 zoom(Arg *arg) { 6.167 unsigned int n;