annotate view.c @ 505:2c29d74b11dc

first step to a more flexible dotile() algorithm
author Anselm R. Garbe <arg@10kloc.org>
date Fri, 29 Sep 2006 12:38:27 +0200
parents 0cefc169ff67
children 2824b5d0f0f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
9 static Client *
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
10 minclient(void) {
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
11 Client *c, *min;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
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
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
15 for(min = c = clients; c; c = c->next)
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
16 if(c->weight < min->weight)
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
17 min = c;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
18 return min;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
19 }
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
20
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
21 static Client *
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
22 nexttiled(Client *c) {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
23 for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
24 return c;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
25 }
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
26
442
056a5072c70a no this is better
Anselm R. Garbe <arg@10kloc.org>
parents: 437
diff changeset
27 static void
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
28 reorder(void) {
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
29 Client *c, *newclients, *tail;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
30
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
31 newclients = tail = NULL;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
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
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
34 if(tail) {
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
35 c->prev = tail;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
36 tail->next = c;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
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
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
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
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
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
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
45 static void
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
46 togglemax(Client *c)
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
47 {
481
arg@mmvi
parents: 480
diff changeset
48 XEvent ev;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
49 if((c->ismax = !c->ismax)) {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
50 c->rx = c->x; c->x = sx;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
51 c->ry = c->y; c->y = bh;
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
52 c->rw = c->w; c->w = sw - 2 * BORDERPX;
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
53 c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
54 }
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
55 else {
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
56 c->x = c->rx;
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
57 c->y = c->ry;
481
arg@mmvi
parents: 480
diff changeset
58 c->w = c->rw;
arg@mmvi
parents: 480
diff changeset
59 c->h = c->rh;
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
60 }
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
61 resize(c, True, TopLeft);
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
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;
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
68 Bool isvertical = VERTICALSTACK;
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
69 StackPos stackpos = STACKPOS;
327
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
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
72 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
73 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
74 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
75 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
76 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
77 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
78 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
79 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
80 }
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
81
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
82 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
83 dofloat(Arg *arg) {
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
84 Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
85
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
86 for(c = clients; c; c = c->next) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
87 if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
88 resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
89 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
90 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
91 ban(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
92 }
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
93 if(!sel || !isvisible(sel)) {
450
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
94 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
95 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
96 }
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
97 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
98 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
99
504
0cefc169ff67 renamed column into area
Anselm R. Garbe <arg@10kloc.org>
parents: 502
diff changeset
100 /* This algorithm is based on a (M)aster area and a (S)tacking area.
0cefc169ff67 renamed column into area
Anselm R. Garbe <arg@10kloc.org>
parents: 502
diff changeset
101 * It supports following arrangements:
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
102 * MMMS MMMM SMMM
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
103 * MMMS MMMM SMMM
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
104 * MMMS SSSS SMMM
504
0cefc169ff67 renamed column into area
Anselm R. Garbe <arg@10kloc.org>
parents: 502
diff changeset
105 */
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
106 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
107 dotile(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
108 int h, i, n, w;
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
109 Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
110
488
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
111 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
112 n++;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
113
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
114 if(isvertical) {
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
115 if(stackpos == StackBottom) {
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
116 w = sw;
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
117 if(n > 1)
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
118 h = (sh - bh) / (n - 1);
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
119 else
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
120 h = sh - bh;
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
121 }
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
122 else {
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
123 w = sw - master;
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
124 if(n > 1)
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
125 h = (sh - bh) / (n - 1);
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
126 else
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
127 h = sh - bh;
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
128 }
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
129 }
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
130 else { /* horizontal stack */
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
131
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
132 }
327
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 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
135 if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
136 if(c->isfloat) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
137 resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
138 continue;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
139 }
488
0d2559f46b9e applied sanders jukka patch
arg@mmvi
parents: 487
diff changeset
140 c->ismax = False;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
141 if(n == 1) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
142 c->x = sx;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
143 c->y = sy + bh;
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
144 c->w = sw - 2 * BORDERPX;
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
145 c->h = sh - 2 * BORDERPX - bh;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
146 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
147 else if(i == 0) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
148 c->x = sx;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
149 c->y = sy + bh;
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
150 c->w = master - 2 * BORDERPX;
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
151 c->h = sh - 2 * BORDERPX - bh;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
152 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
153 else if(h > bh) {
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
154 c->x = sx + master;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
155 c->y = sy + (i - 1) * h + bh;
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
156 c->w = w - 2 * BORDERPX;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
157 if(i + 1 == n)
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
158 c->h = sh - c->y - 2 * BORDERPX;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
159 else
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
160 c->h = h - 2 * BORDERPX;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
161 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
162 else { /* fallback if h < bh */
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
163 c->x = sx + master;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
164 c->y = sy + bh;
502
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
165 c->w = w - 2 * BORDERPX;
9aa3d06199cb applied Jukkas patch
Anselm R. Garbe <arg@10kloc.org>
parents: 488
diff changeset
166 c->h = sh - 2 * BORDERPX - bh;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
167 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
168 resize(c, False, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
169 i++;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
170 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
171 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
172 ban(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
173 }
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
174 if(!sel || !isvisible(sel)) {
450
728c9089b079 applied sanders patch of not manipulating sel
Anselm R. Garbe <arg@10kloc.org>
parents: 446
diff changeset
175 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
176 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
177 }
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
178 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
179 }
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 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
182 focusnext(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
183 Client *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(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
186 return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
187
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
188 if(!(c = getnext(sel->next)))
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
189 c = getnext(clients);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
190 if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
191 focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
192 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
193 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
194 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
195
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
196 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
197 focusprev(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
198 Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
199
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
200 if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
201 return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
202
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
203 if(!(c = getprev(sel->prev))) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
204 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
205 c = getprev(c);
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 if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
208 focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
209 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
210 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
211 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
212
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
213 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
214 isvisible(Client *c) {
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
215 unsigned int i;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
216
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
217 for(i = 0; i < ntags; i++)
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
218 if(c->tags[i] && seltag[i])
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
219 return True;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
220 return False;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
221 }
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
222
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
223 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
224 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
225 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
226 Client *c;
418
Anselm R. Garbe <arg@10kloc.org>
parents: 417
diff changeset
227
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
228 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
229 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
230 n++;
486
8d564b9e3cd4 removed all dotile checks
arg@mmvi
parents: 485
diff changeset
231 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
232 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
233
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
234 if(sel == getnext(clients)) {
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
235 if(master + arg->i > sw - 100 || master + arg->i < 100)
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
236 return;
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
237 master += arg->i;
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
238 }
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
239 else {
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
240 if(master - arg->i > sw - 100 || master - arg->i < 100)
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
241 return;
505
2c29d74b11dc first step to a more flexible dotile() algorithm
Anselm R. Garbe <arg@10kloc.org>
parents: 504
diff changeset
242 master -= arg->i;
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
243 }
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
244 arrange(NULL);
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
245 }
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
246
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
247 void
487
be4f90c03582 applied Jukkas patch
arg@mmvi
parents: 486
diff changeset
248 restack(void) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
249 Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
250 XEvent ev;
481
arg@mmvi
parents: 480
diff changeset
251
437
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
252 if(!sel) {
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
253 drawstatus();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
254 return;
437
433a5c662f73 drawstatus even if no client exists
Anselm R. Garbe <arg@10kloc.org>
parents: 436
diff changeset
255 }
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
256 if(sel->isfloat || arrange == dofloat) {
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
257 XRaiseWindow(dpy, sel->win);
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
258 XRaiseWindow(dpy, sel->twin);
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
259 }
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
260 if(arrange != dofloat)
436
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
261 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
262 XLowerWindow(dpy, c->twin);
b3659c3c5dab sanders solution is convincing and elegant
Anselm R. Garbe <arg@10kloc.org>
parents: 433
diff changeset
263 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
264 }
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
265 drawall();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
266 XSync(dpy, False);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
267 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
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
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
270 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
271 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
272 arrange = (arrange == dofloat) ? dotile : dofloat;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
273 if(sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
274 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
275 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
276 drawstatus();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
277 }
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 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
280 toggleview(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
281 unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
282
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
283 seltag[arg->i] = !seltag[arg->i];
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
284 for(i = 0; i < ntags && !seltag[i]; i++);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
285 if(i == ntags)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
286 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
287 reorder();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
288 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
289 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
290
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
291 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
292 view(Arg *arg) {
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
293 unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
294
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
295 for(i = 0; i < ntags; i++)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
296 seltag[i] = False;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
297 seltag[arg->i] = True;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
298 reorder();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
299 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
300 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
301
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
302 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
303 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
304 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
305
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
306 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
307 seltag[i] = True;
397
cb8a231610c7 reorder was misssing in Ross version of viewall
Anselm R. Garbe <arg@10kloc.org>
parents: 395
diff changeset
308 reorder();
395
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
309 arrange(NULL);
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
310 }
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
311
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
312 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
313 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
314 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
315 Client *c;
473
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
316
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
317 if(!sel)
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
318 return;
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
319
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
320 if(sel->isfloat || (arrange == dofloat)) {
480
680aca428830 small change to achieve Jukka's last proposal
arg@mmvi
parents: 479
diff changeset
321 togglemax(sel);
473
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
322 return;
2d8af0d7920d implemented the maximization as I described on the mailinglist, this feels better to me.
arg@mmvi
parents: 463
diff changeset
323 }
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
324
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
325 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
326 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
327 n++;
486
8d564b9e3cd4 removed all dotile checks
arg@mmvi
parents: 485
diff changeset
328 if(n < 2 || (arrange == dofloat))
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
329 return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
330
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
331 if((c = sel) == nexttiled(clients))
433
a6b8994af164 small fix
Anselm R. Garbe <arg@10kloc.org>
parents: 430
diff changeset
332 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
333 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
334 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
335 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
336 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
337 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
338 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
339 focus(c);
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
340 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
341 }