annotate view.c @ 427:e58cd202c4e9

this makes sure the issue mentioned by sander
author Anselm R. Garbe <arg@10kloc.org>
date Tue, 05 Sep 2006 18:04:22 +0200
parents 21df917c2719
children 16f8f05f960e
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"
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
6 #include <stdio.h>
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
7
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
8 /* static */
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
9
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
10 static Client *
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
11 minclient()
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
12 {
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
13 Client *c, *min;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
14
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
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
21
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
22 static void
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
23 reorder()
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
24 {
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
25 Client *c, *newclients, *tail;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
26
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
27 newclients = tail = NULL;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
28 while((c = minclient())) {
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
29 detach(c);
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
30 if(tail) {
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
31 c->prev = tail;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
32 tail->next = c;
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
33 tail = c;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
34 }
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
35 else
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
36 tail = newclients = c;
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
37 }
382
76b62c0c8c11 improved selection policy
Anselm R. Garbe <arg@10kloc.org>
parents: 381
diff changeset
38 clients = newclients;
380
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
39 }
4bf79305d675 this algorithm seems to keep order for any scenario
Anselm R. Garbe <arg@10kloc.org>
parents: 378
diff changeset
40
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
41 /* extern */
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
42
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
43 void (*arrange)(Arg *) = DEFMODE;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
44
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
45 void
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
46 detach(Client *c)
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 {
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->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
49 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
50 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
51 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
52 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
53 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
54 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
55 }
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
56
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
57 void
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
58 dofloat(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
59 {
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
60 Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
61
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
62 maximized = False;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
63
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
64 for(c = clients; c; c = c->next) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
65 if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
66 resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
67 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
68 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
69 ban(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
70 }
401
1eb2eb405653 reducing focus calls (sanders patch)
Anselm R. Garbe <arg@10kloc.org>
parents: 400
diff changeset
71 if(!sel || !isvisible(sel))
1eb2eb405653 reducing focus calls (sanders patch)
Anselm R. Garbe <arg@10kloc.org>
parents: 400
diff changeset
72 focus(getnext(clients));
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
73 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
74 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
75
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
76 void
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
77 dotile(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
78 {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
79 int h, i, n, w;
402
c7d5ff57998d removed unused vars
Anselm R. Garbe <arg@10kloc.org>
parents: 401
diff changeset
80 Client *c;
400
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
81
052657ff2e7b applied Sanders max_and_focus.patch
Anselm R. Garbe <arg@10kloc.org>
parents: 397
diff changeset
82 maximized = False;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
83
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
84 w = sw - mw;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
85 for(n = 0, c = clients; c; c = c->next)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
86 if(isvisible(c) && !c->isfloat)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
87 n++;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
88
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
89 if(n > 1)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
90 h = (sh - bh) / (n - 1);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
91 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
92 h = sh - bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
93
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
94 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
95 if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
96 if(c->isfloat) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
97 resize(c, True, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
98 continue;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
99 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
100 if(n == 1) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
101 c->x = sx;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
102 c->y = sy + bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
103 c->w = sw - 2;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
104 c->h = sh - 2 - bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
105 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
106 else if(i == 0) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
107 c->x = sx;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
108 c->y = sy + bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
109 c->w = mw - 2;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
110 c->h = sh - 2 - 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 else if(h > bh) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
113 c->x = sx + mw;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
114 c->y = sy + (i - 1) * h + bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
115 c->w = w - 2;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
116 if(i + 1 == n)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
117 c->h = sh - c->y - 2;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
118 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
119 c->h = h - 2;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
120 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
121 else { /* fallback if h < bh */
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
122 c->x = sx + mw;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
123 c->y = sy + bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
124 c->w = w - 2;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
125 c->h = sh - 2 - bh;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
126 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
127 resize(c, False, TopLeft);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
128 i++;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
129 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
130 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
131 ban(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
132 }
401
1eb2eb405653 reducing focus calls (sanders patch)
Anselm R. Garbe <arg@10kloc.org>
parents: 400
diff changeset
133 if(!sel || !isvisible(sel))
1eb2eb405653 reducing focus calls (sanders patch)
Anselm R. Garbe <arg@10kloc.org>
parents: 400
diff changeset
134 focus(getnext(clients));
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
135 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
136 }
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 void
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
139 focusnext(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
140 {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
141 Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
142
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
143 if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
144 return;
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 if(!(c = getnext(sel->next)))
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
147 c = getnext(clients);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
148 if(c) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
149 focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
150 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
151 }
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
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
154 void
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
155 focusprev(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
156 {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
157 Client *c;
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 if(!sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
160 return;
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 if(!(c = getprev(sel->prev))) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
163 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
164 c = getprev(c);
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) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
167 focus(c);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
168 restack();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
169 }
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
420
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
172 Bool
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
173 isvisible(Client *c)
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
174 {
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
175 unsigned int i;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
176
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
177 for(i = 0; i < ntags; i++)
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
178 if(c->tags[i] && seltag[i])
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
179 return True;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
180 return False;
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
181 }
c033e1ade281 s/growcol/resizetile/g
Anselm R. Garbe <arg@10kloc.org>
parents: 419
diff changeset
182
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
183 void
422
44225ee80236 renamed resizetile into resizecol
Anselm R. Garbe <arg@10kloc.org>
parents: 420
diff changeset
184 resizecol(Arg *arg)
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
185 {
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
186 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
187 Client *c;
418
Anselm R. Garbe <arg@10kloc.org>
parents: 417
diff changeset
188
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
189 for(n = 0, c = clients; c; c = c->next)
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
190 if(isvisible(c) && !c->isfloat)
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
191 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
192 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
193 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
194
415
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
195 if(sel == getnext(clients)) {
425
67f37b93ac73 fixing two off-by-ones
Anselm R. Garbe <arg@10kloc.org>
parents: 423
diff changeset
196 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
197 return;
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
198 mw += arg->i;
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
199 }
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
200 else {
425
67f37b93ac73 fixing two off-by-ones
Anselm R. Garbe <arg@10kloc.org>
parents: 423
diff changeset
201 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
202 return;
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
203 mw -= arg->i;
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
204 }
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
205 arrange(NULL);
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
206 }
ad2b6ce6e95b I really need column growing, now pushing upstream
Anselm R. Garbe <arg@10kloc.org>
parents: 414
diff changeset
207
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
208 void
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 static unsigned int nwins = 0;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
212 static Window *wins = NULL;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
213 unsigned int f, fi, m, mi, n;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
214 Client *c;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
215 XEvent ev;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
216
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
217 for(f = 0, m = 0, c = clients; c; c = c->next)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
218 if(isvisible(c)) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
219 if(c->isfloat || arrange == dofloat)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
220 f++;
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 m++;
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 if(!(n = 2 * (f + m))) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
225 drawstatus();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
226 return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
227 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
228 if(nwins < n) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
229 nwins = n;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
230 wins = erealloc(wins, nwins * sizeof(Window));
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
231 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
232
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
233 fi = 0;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
234 mi = 2 * f;
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
235 if(sel) {
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
236 if(sel->isfloat || arrange == dofloat) {
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
237 wins[fi++] = sel->twin;
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
238 wins[fi++] = sel->win;
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
239 }
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
240 else {
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
241 wins[mi++] = sel->twin;
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 wins[mi++] = sel->win;
c6ffcc201229 don't access sel in restack without checking for NULL (multihead crashing bug)
Anselm R. Garbe <arg@10kloc.org>
parents: 402
diff changeset
243 }
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
244 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
245 for(c = clients; c; c = c->next)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
246 if(isvisible(c) && c != sel) {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
247 if(c->isfloat || arrange == dofloat) {
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 333
diff changeset
248 wins[fi++] = c->twin;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
249 wins[fi++] = c->win;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
250 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
251 else {
342
a1901753deef updated man page
Anselm R. Garbe <arg@10kloc.org>
parents: 333
diff changeset
252 wins[mi++] = c->twin;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
253 wins[mi++] = c->win;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
254 }
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 XRestackWindows(dpy, wins, n);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
257 drawall();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
258 XSync(dpy, False);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
259 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
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
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
262 void
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
263 togglemode(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
264 {
333
827f8f6c9e97 separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents: 327
diff changeset
265 arrange = (arrange == dofloat) ? dotile : dofloat;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
266 if(sel)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
267 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
268 else
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
269 drawstatus();
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
270 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
271
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
272 void
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
273 toggleview(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
274 {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
275 unsigned int i;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
276
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
277 seltag[arg->i] = !seltag[arg->i];
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
278 for(i = 0; i < ntags && !seltag[i]; i++);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
279 if(i == ntags)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
280 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
281 reorder();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
282 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
283 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
284
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
285 void
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
286 view(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
287 {
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
288 unsigned int i;
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 for(i = 0; i < ntags; i++)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
291 seltag[i] = False;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
292 seltag[arg->i] = True;
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
293 reorder();
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
294 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
295 }
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
296
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
297 void
395
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
298 viewall(Arg *arg)
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
299 {
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
300 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
301
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
302 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
303 seltag[i] = True;
397
cb8a231610c7 reorder was misssing in Ross version of viewall
Anselm R. Garbe <arg@10kloc.org>
parents: 395
diff changeset
304 reorder();
395
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
305 arrange(NULL);
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
306 }
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
307
7528080beb0e added viewall to mainstream (only Ross Mohns version, not the toggle)
Anselm R. Garbe <arg@10kloc.org>
parents: 393
diff changeset
308 void
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
309 zoom(Arg *arg)
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
310 {
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
311 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
312 Client *c;
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
313
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 for(n = 0, c = clients; c; c = c->next)
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 if(isvisible(c) && !c->isfloat)
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
316 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
317 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
318 return;
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
319
427
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
320 /* this is somewhat tricky, it asserts to only zoom tiled clients */
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
321 for(c = clients; c && c->isfloat; c = getnext(c->next));
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
322 if(c) {
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
323 if(c == sel)
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
324 for(c = getnext(c->next); c && c->isfloat; c = getnext(c->next));
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
325 else
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
326 c = sel;
e58cd202c4e9 this makes sure the issue mentioned by sander
Anselm R. Garbe <arg@10kloc.org>
parents: 426
diff changeset
327 }
426
21df917c2719 fixing zoom
Anselm R. Garbe <arg@10kloc.org>
parents: 425
diff changeset
328 if(!c)
21df917c2719 fixing zoom
Anselm R. Garbe <arg@10kloc.org>
parents: 425
diff changeset
329 return;
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
330 detach(c);
381
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
331 c->next = clients;
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
332 clients->prev = c;
b00cc483d13b still something wrong with reorder()
Anselm R. Garbe <arg@10kloc.org>
parents: 380
diff changeset
333 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
334 focus(c);
327
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
335 arrange(NULL);
96d09fd98e89 separated several functions into view.c
Anselm R. Garbe <arg@10kloc.org>
parents:
diff changeset
336 }