author | Anselm R. Garbe <arg@suckless.org> |
Wed, 31 Jan 2007 20:08:55 +0100 | |
changeset 726 | 0f91934037b0 |
parent 721 | d3876aa79292 |
child 751 | c5f9c2d806e7 |
permissions | -rw-r--r-- |
644 | 1 |
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com> |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
2 |
* See LICENSE file for license details. |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
3 |
*/ |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
4 |
#include "dwm.h" |
674
5d79c351e30a
implemented nmaster appearance in mode label (using %u)
Anselm R. Garbe <arg@suckless.org>
parents:
662
diff
changeset
|
5 |
#include <stdio.h> |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
6 |
|
380
4bf79305d675
this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
7 |
/* static */ |
4bf79305d675
this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
8 |
|
382 | 9 |
static Client * |
480 | 10 |
nexttiled(Client *c) { |
11 |
for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); |
|
12 |
return c; |
|
13 |
} |
|
14 |
||
442 | 15 |
static void |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
531
diff
changeset
|
16 |
togglemax(Client *c) { |
481 | 17 |
XEvent ev; |
548 | 18 |
|
549 | 19 |
if(c->isfixed) |
548 | 20 |
return; |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
531
diff
changeset
|
21 |
|
480 | 22 |
if((c->ismax = !c->ismax)) { |
565 | 23 |
c->rx = c->x; c->x = wax; |
24 |
c->ry = c->y; c->y = way; |
|
25 |
c->rw = c->w; c->w = waw - 2 * BORDERPX; |
|
26 |
c->rh = c->h; c->h = wah - 2 * BORDERPX; |
|
480 | 27 |
} |
28 |
else { |
|
29 |
c->x = c->rx; |
|
30 |
c->y = c->ry; |
|
481 | 31 |
c->w = c->rw; |
32 |
c->h = c->rh; |
|
480 | 33 |
} |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
691
diff
changeset
|
34 |
resize(c, True); |
480 | 35 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
430
1e8aba00964e
no, reodering floating clients definately breaks the manage() policy which attaches all clients zoomed (otherwise higher-weight clients couldn't be attached zoomed, which sucks)
Anselm R. Garbe <arg@10kloc.org>
parents:
429
diff
changeset
|
36 |
} |
1e8aba00964e
no, reodering floating clients definately breaks the manage() policy which attaches all clients zoomed (otherwise higher-weight clients couldn't be attached zoomed, which sucks)
Anselm R. Garbe <arg@10kloc.org>
parents:
429
diff
changeset
|
37 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
38 |
/* extern */ |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
39 |
|
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
40 |
void (*arrange)(void) = DEFMODE; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
41 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
42 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
43 |
detach(Client *c) { |
378
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
44 |
if(c->prev) |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
45 |
c->prev->next = c->next; |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
46 |
if(c->next) |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
47 |
c->next->prev = c->prev; |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
48 |
if(c == clients) |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
49 |
clients = c->next; |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
50 |
c->next = c->prev = NULL; |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
51 |
} |
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
52 |
|
83576f5f0a90
added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
Anselm R. Garbe <arg@10kloc.org>
parents:
342
diff
changeset
|
53 |
void |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
54 |
dofloat(void) { |
402 | 55 |
Client *c; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
397
diff
changeset
|
56 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
57 |
for(c = clients; c; c = c->next) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
58 |
if(isvisible(c)) { |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
691
diff
changeset
|
59 |
resize(c, True); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
60 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
61 |
else |
687
a76799907854
removed client title bar
Anselm R. Garbe <arg@suckless.org>
parents:
682
diff
changeset
|
62 |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
63 |
} |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
443
diff
changeset
|
64 |
if(!sel || !isvisible(sel)) { |
450
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
65 |
for(c = stack; c && !isvisible(c); c = c->snext); |
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
66 |
focus(c); |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
443
diff
changeset
|
67 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
68 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
69 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
70 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
71 |
void |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
72 |
dotile(void) { |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
73 |
unsigned int i, n, mw, mh, tw, th; |
402 | 74 |
Client *c; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
397
diff
changeset
|
75 |
|
488 | 76 |
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
77 |
n++; |
|
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
78 |
/* window geoms */ |
682
76b58d21ea98
removing to allow nmaster=0
Anselm R. Garbe <arg@suckless.org>
parents:
678
diff
changeset
|
79 |
mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); |
76b58d21ea98
removing to allow nmaster=0
Anselm R. Garbe <arg@suckless.org>
parents:
678
diff
changeset
|
80 |
mw = (n > nmaster) ? (waw * master) / 1000 : waw; |
678
4dcbbfe9d137
allowing nmaster=0 (I think that's a straight idea)
Anselm R. Garbe <arg@suckless.org>
parents:
675
diff
changeset
|
81 |
th = (n > nmaster) ? wah / (n - nmaster) : 0; |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
82 |
tw = waw - mw; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
83 |
|
535 | 84 |
for(i = 0, c = clients; c; c = c->next) |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
85 |
if(isvisible(c)) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
86 |
if(c->isfloat) { |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
691
diff
changeset
|
87 |
resize(c, True); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
88 |
continue; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
89 |
} |
488 | 90 |
c->ismax = False; |
565 | 91 |
c->x = wax; |
92 |
c->y = way; |
|
682
76b58d21ea98
removing to allow nmaster=0
Anselm R. Garbe <arg@suckless.org>
parents:
678
diff
changeset
|
93 |
if(i < nmaster) { |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
94 |
c->y += i * mh; |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
95 |
c->w = mw - 2 * BORDERPX; |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
96 |
c->h = mh - 2 * BORDERPX; |
507 | 97 |
} |
523
c1dd19da63ef
yet another simplification of dotile()
Anselm R. Garbe <arg@10kloc.org>
parents:
522
diff
changeset
|
98 |
else { /* tile window */ |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
99 |
c->x += mw; |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
100 |
c->w = tw - 2 * BORDERPX; |
726
0f91934037b0
applied Sander's drop_bh patch
Anselm R. Garbe <arg@suckless.org>
parents:
721
diff
changeset
|
101 |
if(th > 2 * BORDERPX) { |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
102 |
c->y += (i - nmaster) * th; |
565 | 103 |
c->h = th - 2 * BORDERPX; |
507 | 104 |
} |
726
0f91934037b0
applied Sander's drop_bh patch
Anselm R. Garbe <arg@suckless.org>
parents:
721
diff
changeset
|
105 |
else /* fallback if th <= 2 * BORDERPX */ |
565 | 106 |
c->h = wah - 2 * BORDERPX; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
107 |
} |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
691
diff
changeset
|
108 |
resize(c, False); |
535 | 109 |
i++; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
110 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
111 |
else |
687
a76799907854
removed client title bar
Anselm R. Garbe <arg@suckless.org>
parents:
682
diff
changeset
|
112 |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
443
diff
changeset
|
113 |
if(!sel || !isvisible(sel)) { |
450
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
114 |
for(c = stack; c && !isvisible(c); c = c->snext); |
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
115 |
focus(c); |
446
a2e587651c79
using a global stack for focus recovery on arrange() - seems to work great
Anselm R. Garbe <arg@10kloc.org>
parents:
443
diff
changeset
|
116 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
117 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
118 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
119 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
120 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
121 |
focusnext(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
122 |
Client *c; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
123 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
124 |
if(!sel) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
125 |
return; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
126 |
if(!(c = getnext(sel->next))) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
127 |
c = getnext(clients); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
128 |
if(c) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
129 |
focus(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
130 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
131 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
132 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
133 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
134 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
135 |
focusprev(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
136 |
Client *c; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
137 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
138 |
if(!sel) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
139 |
return; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
140 |
if(!(c = getprev(sel->prev))) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
141 |
for(c = clients; c && c->next; c = c->next); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
142 |
c = getprev(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
143 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
144 |
if(c) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
145 |
focus(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
146 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
147 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
148 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
149 |
|
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
150 |
void |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
151 |
incnmaster(Arg *arg) { |
721
d3876aa79292
prepared yet another hotfix release
Anselm R. Garbe <arg@suckless.org>
parents:
708
diff
changeset
|
152 |
if((arrange == dofloat) || (nmaster + arg->i < 1) |
726
0f91934037b0
applied Sander's drop_bh patch
Anselm R. Garbe <arg@suckless.org>
parents:
721
diff
changeset
|
153 |
|| (wah / (nmaster + arg->i) <= 2 * BORDERPX)) |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
154 |
return; |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
155 |
nmaster += arg->i; |
674
5d79c351e30a
implemented nmaster appearance in mode label (using %u)
Anselm R. Garbe <arg@suckless.org>
parents:
662
diff
changeset
|
156 |
if(sel) |
5d79c351e30a
implemented nmaster appearance in mode label (using %u)
Anselm R. Garbe <arg@suckless.org>
parents:
662
diff
changeset
|
157 |
arrange(); |
5d79c351e30a
implemented nmaster appearance in mode label (using %u)
Anselm R. Garbe <arg@suckless.org>
parents:
662
diff
changeset
|
158 |
else |
5d79c351e30a
implemented nmaster appearance in mode label (using %u)
Anselm R. Garbe <arg@suckless.org>
parents:
662
diff
changeset
|
159 |
drawstatus(); |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
160 |
} |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
161 |
|
420 | 162 |
Bool |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
163 |
isvisible(Client *c) { |
420 | 164 |
unsigned int i; |
165 |
||
166 |
for(i = 0; i < ntags; i++) |
|
167 |
if(c->tags[i] && seltag[i]) |
|
168 |
return True; |
|
169 |
return False; |
|
170 |
} |
|
171 |
||
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
172 |
void |
559 | 173 |
resizemaster(Arg *arg) { |
561 | 174 |
if(arg->i == 0) |
175 |
master = MASTER; |
|
176 |
else { |
|
726
0f91934037b0
applied Sander's drop_bh patch
Anselm R. Garbe <arg@suckless.org>
parents:
721
diff
changeset
|
177 |
if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX |
0f91934037b0
applied Sander's drop_bh patch
Anselm R. Garbe <arg@suckless.org>
parents:
721
diff
changeset
|
178 |
|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX) |
561 | 179 |
return; |
180 |
master += arg->i; |
|
181 |
} |
|
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
182 |
arrange(); |
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
183 |
} |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
184 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
185 |
void |
487 | 186 |
restack(void) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
187 |
Client *c; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
188 |
XEvent ev; |
481 | 189 |
|
691
5d7e363f889d
changed restack, to fix undrawed tag indicators
Anselm R. Garbe <arg@suckless.org>
parents:
690
diff
changeset
|
190 |
drawstatus(); |
5d7e363f889d
changed restack, to fix undrawed tag indicators
Anselm R. Garbe <arg@suckless.org>
parents:
690
diff
changeset
|
191 |
if(!sel) |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
192 |
return; |
687
a76799907854
removed client title bar
Anselm R. Garbe <arg@suckless.org>
parents:
682
diff
changeset
|
193 |
if(sel->isfloat || arrange == dofloat) |
436
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
194 |
XRaiseWindow(dpy, sel->win); |
512
aca04c3022c1
fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents:
511
diff
changeset
|
195 |
if(arrange != dofloat) { |
687
a76799907854
removed client title bar
Anselm R. Garbe <arg@suckless.org>
parents:
682
diff
changeset
|
196 |
if(!sel->isfloat) |
512
aca04c3022c1
fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents:
511
diff
changeset
|
197 |
XLowerWindow(dpy, sel->win); |
436
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
198 |
for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
512
aca04c3022c1
fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents:
511
diff
changeset
|
199 |
if(c == sel) |
aca04c3022c1
fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents:
511
diff
changeset
|
200 |
continue; |
436
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
201 |
XLowerWindow(dpy, c->win); |
414
c6ffcc201229
don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents:
402
diff
changeset
|
202 |
} |
512
aca04c3022c1
fixed the z-layer issue described on mailinglist
Anselm R. Garbe <arg@10kloc.org>
parents:
511
diff
changeset
|
203 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
204 |
XSync(dpy, False); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
205 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
206 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
207 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
208 |
void |
584
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
209 |
togglefloat(Arg *arg) { |
591
d9e9df9fdce6
togglefloat should only work in dotile mode (thanks to Sander for this hint)
arg@mig29
parents:
588
diff
changeset
|
210 |
if (!sel || arrange == dofloat) |
584
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
211 |
return; |
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
212 |
sel->isfloat = !sel->isfloat; |
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
213 |
arrange(); |
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
214 |
} |
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
215 |
|
37281ebc1b5b
added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut
arg@mig29
parents:
573
diff
changeset
|
216 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
217 |
togglemode(Arg *arg) { |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
327
diff
changeset
|
218 |
arrange = (arrange == dofloat) ? dotile : dofloat; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
219 |
if(sel) |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
220 |
arrange(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
221 |
else |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
222 |
drawstatus(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
223 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
224 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
225 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
226 |
toggleview(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
227 |
unsigned int i; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
228 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
229 |
seltag[arg->i] = !seltag[arg->i]; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
230 |
for(i = 0; i < ntags && !seltag[i]; i++); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
231 |
if(i == ntags) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
232 |
seltag[arg->i] = True; /* cannot toggle last view */ |
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
233 |
arrange(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
234 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
235 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
236 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
237 |
view(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
238 |
unsigned int i; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
239 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
240 |
for(i = 0; i < ntags; i++) |
594
f7dcd3ac8d6f
removed viewall(), replaced with view(-1); added tag(-1) to tag a client with all tags (new key combo MODKEY-Shift-0)
arg@mig29
parents:
591
diff
changeset
|
241 |
seltag[i] = (arg->i == -1) ? True : False; |
611 | 242 |
if(arg->i >= 0 && arg->i < ntags) |
243 |
seltag[arg->i] = True; |
|
533
a5567a0d3011
do* has no Arg arument anymore (never called directly)
Anselm R. Garbe <arg@10kloc.org>
parents:
532
diff
changeset
|
244 |
arrange(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
245 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
246 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
247 |
void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
450
diff
changeset
|
248 |
zoom(Arg *arg) { |
651
b9f4efd21473
added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients)
Anselm R. Garbe <arg@suckless.org>
parents:
650
diff
changeset
|
249 |
unsigned int n; |
423
6ba5dd429122
applied checking existance of >2 tiles patch (proposed by sander) to zoom and resizecol
Anselm R. Garbe <arg@10kloc.org>
parents:
422
diff
changeset
|
250 |
Client *c; |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
251 |
|
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
252 |
if(!sel) |
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
253 |
return; |
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
254 |
if(sel->isfloat || (arrange == dofloat)) { |
480 | 255 |
togglemax(sel); |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
256 |
return; |
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
257 |
} |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
258 |
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
644
diff
changeset
|
259 |
n++; |
654
04734db9a219
allowing zoom within master area as well
Anselm R. Garbe <arg@suckless.org>
parents:
651
diff
changeset
|
260 |
|
662
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
261 |
if((c = sel) == nexttiled(clients)) |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
262 |
if(!(c = nexttiled(c->next))) |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
263 |
return; |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
264 |
detach(c); |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
265 |
if(clients) |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
266 |
clients->prev = c; |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
267 |
c->next = clients; |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
268 |
clients = c; |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
269 |
focus(c); |
3e0f11a44293
allowing swap() for first master client
Anselm R. Garbe <arg@suckless.org>
parents:
661
diff
changeset
|
270 |
arrange(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
271 |
} |