author | Anselm R. Garbe <arg@10kloc.org> |
Thu, 28 Sep 2006 14:03:39 +0200 | |
changeset 502 | 9aa3d06199cb |
parent 488 | 0d2559f46b9e |
child 504 | 0cefc169ff67 |
permissions | -rw-r--r-- |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
1 |
/* |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
2 |
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
3 |
* See LICENSE file for license details. |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
4 |
*/ |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
5 |
#include "dwm.h" |
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 * |
487 | 10 |
minclient(void) { |
382 | 11 |
Client *c, *min; |
12 |
||
443
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
13 |
if((clients && clients->isfloat) || arrange == dofloat) |
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
14 |
return clients; /* don't touch floating order */ |
382 | 15 |
for(min = c = clients; c; c = c->next) |
16 |
if(c->weight < min->weight) |
|
17 |
min = c; |
|
18 |
return min; |
|
19 |
} |
|
20 |
||
480 | 21 |
static Client * |
22 |
nexttiled(Client *c) { |
|
23 |
for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); |
|
24 |
return c; |
|
25 |
} |
|
26 |
||
442 | 27 |
static void |
487 | 28 |
reorder(void) { |
382 | 29 |
Client *c, *newclients, *tail; |
381
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
380
diff
changeset
|
30 |
|
382 | 31 |
newclients = tail = NULL; |
32 |
while((c = minclient())) { |
|
381
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
380
diff
changeset
|
33 |
detach(c); |
382 | 34 |
if(tail) { |
35 |
c->prev = tail; |
|
36 |
tail->next = c; |
|
37 |
tail = c; |
|
381
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
380
diff
changeset
|
38 |
} |
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
380
diff
changeset
|
39 |
else |
382 | 40 |
tail = newclients = c; |
380
4bf79305d675
this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
41 |
} |
382 | 42 |
clients = newclients; |
380
4bf79305d675
this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
43 |
} |
4bf79305d675
this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents:
378
diff
changeset
|
44 |
|
480 | 45 |
static void |
46 |
togglemax(Client *c) |
|
47 |
{ |
|
481 | 48 |
XEvent ev; |
480 | 49 |
if((c->ismax = !c->ismax)) { |
50 |
c->rx = c->x; c->x = sx; |
|
51 |
c->ry = c->y; c->y = bh; |
|
502 | 52 |
c->rw = c->w; c->w = sw - 2 * BORDERPX; |
53 |
c->rh = c->h; c->h = sh - bh - 2 * BORDERPX; |
|
480 | 54 |
} |
55 |
else { |
|
56 |
c->x = c->rx; |
|
57 |
c->y = c->ry; |
|
481 | 58 |
c->w = c->rw; |
59 |
c->h = c->rh; |
|
480 | 60 |
} |
61 |
resize(c, True, TopLeft); |
|
62 |
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
|
63 |
} |
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
|
64 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
65 |
/* extern */ |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
66 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
67 |
void (*arrange)(Arg *) = DEFMODE; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
68 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
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
|
77 |
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
|
78 |
} |
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
|
79 |
|
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
|
80 |
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
|
81 |
dofloat(Arg *arg) { |
402 | 82 |
Client *c; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
397
diff
changeset
|
83 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
84 |
for(c = clients; c; c = c->next) { |
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 |
resize(c, True, TopLeft); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
87 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
88 |
else |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
89 |
ban(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
90 |
} |
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
|
91 |
if(!sel || !isvisible(sel)) { |
450
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
92 |
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
|
93 |
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
|
94 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
95 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
96 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
97 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
98 |
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
|
99 |
dotile(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
100 |
int h, i, n, w; |
402 | 101 |
Client *c; |
400
052657ff2e7b
applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents:
397
diff
changeset
|
102 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
103 |
w = sw - mw; |
488 | 104 |
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
105 |
n++; |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
106 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
107 |
if(n > 1) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
108 |
h = (sh - bh) / (n - 1); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
109 |
else |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
110 |
h = sh - bh; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
111 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
112 |
for(i = 0, c = clients; c; c = c->next) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
113 |
if(isvisible(c)) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
114 |
if(c->isfloat) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
115 |
resize(c, True, TopLeft); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
116 |
continue; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
117 |
} |
488 | 118 |
c->ismax = False; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
119 |
if(n == 1) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
120 |
c->x = sx; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
121 |
c->y = sy + bh; |
502 | 122 |
c->w = sw - 2 * BORDERPX; |
123 |
c->h = sh - 2 * BORDERPX - bh; |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
124 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
125 |
else if(i == 0) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
126 |
c->x = sx; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
127 |
c->y = sy + bh; |
502 | 128 |
c->w = mw - 2 * BORDERPX; |
129 |
c->h = sh - 2 * BORDERPX - bh; |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
130 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
131 |
else if(h > bh) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
132 |
c->x = sx + mw; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
133 |
c->y = sy + (i - 1) * h + bh; |
502 | 134 |
c->w = w - 2 * BORDERPX; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
135 |
if(i + 1 == n) |
502 | 136 |
c->h = sh - c->y - 2 * BORDERPX; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
137 |
else |
502 | 138 |
c->h = h - 2 * BORDERPX; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
139 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
140 |
else { /* fallback if h < bh */ |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
141 |
c->x = sx + mw; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
142 |
c->y = sy + bh; |
502 | 143 |
c->w = w - 2 * BORDERPX; |
144 |
c->h = sh - 2 * BORDERPX - bh; |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
145 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
146 |
resize(c, False, TopLeft); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
147 |
i++; |
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 |
else |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
150 |
ban(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
151 |
} |
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
|
152 |
if(!sel || !isvisible(sel)) { |
450
728c9089b079
applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
153 |
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
|
154 |
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
|
155 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
156 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
157 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
158 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
159 |
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
|
160 |
focusnext(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
161 |
Client *c; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
162 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
163 |
if(!sel) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
164 |
return; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
165 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
166 |
if(!(c = getnext(sel->next))) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
167 |
c = getnext(clients); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
168 |
if(c) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
169 |
focus(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
170 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
171 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
172 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
173 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
174 |
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
|
175 |
focusprev(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
176 |
Client *c; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
177 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
178 |
if(!sel) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
179 |
return; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
180 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
181 |
if(!(c = getprev(sel->prev))) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
182 |
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
|
183 |
c = getprev(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
184 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
185 |
if(c) { |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
186 |
focus(c); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
187 |
restack(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
188 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
189 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
190 |
|
420 | 191 |
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
|
192 |
isvisible(Client *c) { |
420 | 193 |
unsigned int i; |
194 |
||
195 |
for(i = 0; i < ntags; i++) |
|
196 |
if(c->tags[i] && seltag[i]) |
|
197 |
return True; |
|
198 |
return False; |
|
199 |
} |
|
200 |
||
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
201 |
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
|
202 |
resizecol(Arg *arg) { |
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
|
203 |
unsigned int n; |
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
|
204 |
Client *c; |
418 | 205 |
|
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
|
206 |
for(n = 0, c = clients; c; c = c->next) |
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
|
207 |
if(isvisible(c) && !c->isfloat) |
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
|
208 |
n++; |
486 | 209 |
if(!sel || sel->isfloat || n < 2 || (arrange == dofloat)) |
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
210 |
return; |
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
|
211 |
|
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
212 |
if(sel == getnext(clients)) { |
425 | 213 |
if(mw + arg->i > sw - 100 || mw + arg->i < 100) |
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
214 |
return; |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
215 |
mw += arg->i; |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
216 |
} |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
217 |
else { |
425 | 218 |
if(mw - arg->i > sw - 100 || mw - arg->i < 100) |
415
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
219 |
return; |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
220 |
mw -= arg->i; |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
221 |
} |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
222 |
arrange(NULL); |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
223 |
} |
ad2b6ce6e95b
I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents:
414
diff
changeset
|
224 |
|
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
225 |
void |
487 | 226 |
restack(void) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
227 |
Client *c; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
228 |
XEvent ev; |
481 | 229 |
|
437
433a5c662f73
drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents:
436
diff
changeset
|
230 |
if(!sel) { |
433a5c662f73
drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents:
436
diff
changeset
|
231 |
drawstatus(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
232 |
return; |
437
433a5c662f73
drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents:
436
diff
changeset
|
233 |
} |
436
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
234 |
if(sel->isfloat || arrange == dofloat) { |
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
235 |
XRaiseWindow(dpy, sel->win); |
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
236 |
XRaiseWindow(dpy, sel->twin); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
237 |
} |
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
|
238 |
if(arrange != dofloat) |
436
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
239 |
for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
240 |
XLowerWindow(dpy, c->twin); |
b3659c3c5dab
sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents:
433
diff
changeset
|
241 |
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
|
242 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
243 |
drawall(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
244 |
XSync(dpy, False); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
245 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
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 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
248 |
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
|
249 |
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
|
250 |
arrange = (arrange == dofloat) ? dotile : dofloat; |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
251 |
if(sel) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
252 |
arrange(NULL); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
253 |
else |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
254 |
drawstatus(); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
255 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
256 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
257 |
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
|
258 |
toggleview(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
259 |
unsigned int i; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
260 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
261 |
seltag[arg->i] = !seltag[arg->i]; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
262 |
for(i = 0; i < ntags && !seltag[i]; i++); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
263 |
if(i == ntags) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
264 |
seltag[arg->i] = True; /* cannot toggle last view */ |
381
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
380
diff
changeset
|
265 |
reorder(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
266 |
arrange(NULL); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
267 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
268 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
269 |
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
|
270 |
view(Arg *arg) { |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
271 |
unsigned int i; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
272 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
273 |
for(i = 0; i < ntags; i++) |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
274 |
seltag[i] = False; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
275 |
seltag[arg->i] = True; |
381
b00cc483d13b
still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents:
380
diff
changeset
|
276 |
reorder(); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
277 |
arrange(NULL); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
278 |
} |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
279 |
|
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
280 |
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
|
281 |
viewall(Arg *arg) { |
395
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
282 |
unsigned int i; |
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
283 |
|
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
284 |
for(i = 0; i < ntags; i++) |
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
285 |
seltag[i] = True; |
397
cb8a231610c7
reorder was misssing in Ross version of viewall
Anselm R. Garbe <arg@10kloc.org>
parents:
395
diff
changeset
|
286 |
reorder(); |
395
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
287 |
arrange(NULL); |
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
288 |
} |
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
289 |
|
7528080beb0e
added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents:
393
diff
changeset
|
290 |
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
|
291 |
zoom(Arg *arg) { |
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
|
292 |
unsigned int n; |
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
|
293 |
Client *c; |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
294 |
|
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
295 |
if(!sel) |
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
296 |
return; |
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
297 |
|
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
298 |
if(sel->isfloat || (arrange == dofloat)) { |
480 | 299 |
togglemax(sel); |
473
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
300 |
return; |
2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents:
463
diff
changeset
|
301 |
} |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
302 |
|
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
|
303 |
for(n = 0, c = clients; c; c = c->next) |
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
|
304 |
if(isvisible(c) && !c->isfloat) |
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
|
305 |
n++; |
486 | 306 |
if(n < 2 || (arrange == dofloat)) |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
307 |
return; |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
308 |
|
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
|
309 |
if((c = sel) == nexttiled(clients)) |
433 | 310 |
if(!(c = nexttiled(c->next))) |
429
a31de8605f72
no, ordering floating clients at the end seems better
Anselm R. Garbe <arg@10kloc.org>
parents:
428
diff
changeset
|
311 |
return; |
443
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
312 |
detach(c); |
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
313 |
if(clients) |
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
314 |
clients->prev = c; |
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
315 |
c->next = clients; |
548084f8d92e
this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled
Anselm R. Garbe <arg@10kloc.org>
parents:
442
diff
changeset
|
316 |
clients = 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
|
317 |
focus(c); |
327
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
318 |
arrange(NULL); |
96d09fd98e89
separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff
changeset
|
319 |
} |