Mercurial > dwm-meillo
annotate tag.c @ 313:8b109976c594
fixed a bug reported by sander
author | Anselm R.Garbe <arg@10ksloc.org> |
---|---|
date | Thu, 17 Aug 2006 10:06:36 +0200 |
parents | ec8a66a2b9cc |
children | 96d09fd98e89 |
rev | line source |
---|---|
75 | 1 /* |
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | |
3 * See LICENSE file for license details. | |
4 */ | |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
5 #include "dwm.h" |
114 | 6 #include <regex.h> |
7 #include <stdio.h> | |
191 | 8 #include <stdlib.h> |
75 | 9 #include <string.h> |
114 | 10 #include <sys/types.h> |
75 | 11 #include <X11/Xutil.h> |
12 | |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
13 |
114 | 14 typedef struct { |
191 | 15 const char *clpattern; |
16 const char *tpattern; | |
114 | 17 Bool isfloat; |
18 } Rule; | |
19 | |
191 | 20 typedef struct { |
21 regex_t *clregex; | |
22 regex_t *tregex; | |
23 } RReg; | |
24 | |
25 /* static */ | |
26 | |
146
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
144
diff
changeset
|
27 TAGS |
f328ce9c558c
centralized/externalized configuration to config.h
arg@10ksloc.org
parents:
144
diff
changeset
|
28 RULES |
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
80
diff
changeset
|
29 |
191 | 30 static RReg *rreg = NULL; |
31 static unsigned int len = 0; | |
32 | |
156 | 33 void (*arrange)(Arg *) = DEFMODE; |
125 | 34 |
35 /* extern */ | |
36 | |
75 | 37 void |
38 dofloat(Arg *arg) | |
39 { | |
40 Client *c; | |
41 | |
42 for(c = clients; c; c = c->next) { | |
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
43 c->ismax = False; |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
44 if(isvisible(c)) { |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
97
diff
changeset
|
45 resize(c, True, TopLeft); |
95
5d88952cbf96
implemened distinguishing float/managed geometries of clients (works quite well)
Anselm R. Garbe <garbeam@wmii.de>
parents:
94
diff
changeset
|
46 } |
75 | 47 else |
48 ban(c); | |
49 } | |
289 | 50 if(!sel || !isvisible(sel)) |
51 sel = getnext(clients); | |
307
ec8a66a2b9cc
fixed issue reported by sander
Anselm R.Garbe <arg@10ksloc.org>
parents:
306
diff
changeset
|
52 if(sel) |
194 | 53 focus(sel); |
54 else | |
55 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | |
307
ec8a66a2b9cc
fixed issue reported by sander
Anselm R.Garbe <arg@10ksloc.org>
parents:
306
diff
changeset
|
56 restack(); |
75 | 57 } |
58 | |
59 void | |
60 dotile(Arg *arg) | |
61 { | |
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
62 int h, i, n, w; |
75 | 63 Client *c; |
64 | |
65 w = sw - mw; | |
66 for(n = 0, c = clients; c; c = c->next) | |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
67 if(isvisible(c) && !c->isfloat) |
75 | 68 n++; |
69 | |
70 if(n > 1) | |
71 h = (sh - bh) / (n - 1); | |
72 else | |
73 h = sh - bh; | |
74 | |
75 for(i = 0, c = clients; c; c = c->next) { | |
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
76 c->ismax = False; |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
77 if(isvisible(c)) { |
80
8125f908c80c
several additions in mouse handling ;)
Anselm R. Garbe <garbeam@wmii.de>
parents:
76
diff
changeset
|
78 if(c->isfloat) { |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
97
diff
changeset
|
79 resize(c, True, TopLeft); |
75 | 80 continue; |
81 } | |
82 if(n == 1) { | |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
83 c->x = sx; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
84 c->y = sy + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
85 c->w = sw - 2; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
86 c->h = sh - 2 - bh; |
75 | 87 } |
88 else if(i == 0) { | |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
89 c->x = sx; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
90 c->y = sy + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
91 c->w = mw - 2; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
92 c->h = sh - 2 - bh; |
75 | 93 } |
104
3a708f113f55
implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents:
99
diff
changeset
|
94 else if(h > bh) { |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
95 c->x = sx + mw; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
96 c->y = sy + (i - 1) * h + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
97 c->w = w - 2; |
240
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
98 if(i + 1 == n) |
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
99 c->h = sh - c->y - 2; |
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
100 else |
87c5d5176e17
fixed the issue reported by sander (gaps at left columns button due to round-offs)
Anselm R.Garbe <arg@10ksloc.org>
parents:
194
diff
changeset
|
101 c->h = h - 2; |
75 | 102 } |
104
3a708f113f55
implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents:
99
diff
changeset
|
103 else { /* fallback if h < bh */ |
115
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
104 c->x = sx + mw; |
329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
arg@10ksloc.org
parents:
114
diff
changeset
|
105 c->y = sy + bh; |
164
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
106 c->w = w - 2; |
21071ae1fe68
made fullscreen apps working fine in floating mode (there is no sane way to make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
arg@10ksloc.org
parents:
156
diff
changeset
|
107 c->h = sh - 2 - bh; |
104
3a708f113f55
implemented fallback for too many clients in stacked mode
arg@10ksloc.org
parents:
99
diff
changeset
|
108 } |
99
a19556fe83b5
applied Sanders resize patch, fixed lower bug
arg@10ksloc.org
parents:
97
diff
changeset
|
109 resize(c, False, TopLeft); |
75 | 110 i++; |
111 } | |
112 else | |
113 ban(c); | |
114 } | |
289 | 115 if(!sel || !isvisible(sel)) |
116 sel = getnext(clients); | |
117 if(sel) | |
194 | 118 focus(sel); |
119 else | |
120 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | |
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
121 restack(); |
75 | 122 } |
123 | |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
124 Client * |
142
9b9deafa0508
committed a patch which fixes the hints of Jukka
arg@10ksloc.org
parents:
138
diff
changeset
|
125 getnext(Client *c) |
93
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
126 { |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
127 for(; c && !isvisible(c); c = c->next); |
93
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
128 return c; |
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
129 } |
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
130 |
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
131 Client * |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
132 getprev(Client *c) |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
133 { |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
134 for(; c && !isvisible(c); c = c->prev); |
127
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
135 return c; |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
136 } |
1480e19f6377
using double-linked list in order to get correct prev focus handling
arg@10ksloc.org
parents:
125
diff
changeset
|
137 |
93
c498da7520c7
added heretag command which allows to tag a client of a foreign tag with current tag
Anselm R. Garbe <garbeam@wmii.de>
parents:
84
diff
changeset
|
138 void |
191 | 139 initrregs() |
140 { | |
141 unsigned int i; | |
142 regex_t *reg; | |
143 | |
144 if(rreg) | |
145 return; | |
146 len = sizeof(rule) / sizeof(rule[0]); | |
147 rreg = emallocz(len * sizeof(RReg)); | |
148 | |
149 for(i = 0; i < len; i++) { | |
150 if(rule[i].clpattern) { | |
151 reg = emallocz(sizeof(regex_t)); | |
152 if(regcomp(reg, rule[i].clpattern, 0)) | |
153 free(reg); | |
154 else | |
155 rreg[i].clregex = reg; | |
156 } | |
157 if(rule[i].tpattern) { | |
158 reg = emallocz(sizeof(regex_t)); | |
159 if(regcomp(reg, rule[i].tpattern, 0)) | |
160 free(reg); | |
161 else | |
162 rreg[i].tregex = reg; | |
163 } | |
164 } | |
165 } | |
166 | |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
167 Bool |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
168 isvisible(Client *c) |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
169 { |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
170 unsigned int i; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
171 |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
172 for(i = 0; i < ntags; i++) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
173 if(c->tags[i] && seltag[i]) |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
174 return True; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
175 return False; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
176 } |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
177 |
191 | 178 void |
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
179 restack() |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
180 { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
181 static unsigned int nwins = 0; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
182 static Window *wins = NULL; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
183 unsigned int f, fi, m, mi, n; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
184 Client *c; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
185 XEvent ev; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
186 |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
187 for(f = 0, m = 0, c = clients; c; c = c->next) |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
188 if(isvisible(c)) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
189 if(c->isfloat || arrange == dofloat) |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
190 f++; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
191 else |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
192 m++; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
193 } |
272 | 194 if(!(n = 2 * (f + m))) { |
195 drawstatus(); | |
196 return; | |
197 } | |
270
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
198 if(nwins < n) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
199 nwins = n; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
200 wins = erealloc(wins, nwins * sizeof(Window)); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
201 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
202 |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
203 fi = 0; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
204 mi = 2 * f; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
205 if(sel->isfloat || arrange == dofloat) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
206 wins[fi++] = sel->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
207 wins[fi++] = sel->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
208 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
209 else { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
210 wins[mi++] = sel->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
211 wins[mi++] = sel->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
212 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
213 for(c = clients; c; c = c->next) |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
214 if(isvisible(c) && c != sel) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
215 if(c->isfloat || arrange == dofloat) { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
216 wins[fi++] = c->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
217 wins[fi++] = c->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
218 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
219 else { |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
220 wins[mi++] = c->title; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
221 wins[mi++] = c->win; |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
222 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
223 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
224 XRestackWindows(dpy, wins, n); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
225 drawall(); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
226 XSync(dpy, False); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
227 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
228 } |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
229 |
dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
Anselm R.Garbe <arg@10ksloc.org>
parents:
267
diff
changeset
|
230 void |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
231 settags(Client *c) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
232 { |
114 | 233 char classinst[256]; |
191 | 234 unsigned int i, j; |
114 | 235 regmatch_t tmp; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
236 Bool matched = False; |
114 | 237 XClassHint ch; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
238 |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
239 if(XGetClassHint(dpy, c->win, &ch)) { |
114 | 240 snprintf(classinst, sizeof(classinst), "%s:%s", |
241 ch.res_class ? ch.res_class : "", | |
242 ch.res_name ? ch.res_name : ""); | |
191 | 243 for(i = 0; !matched && i < len; i++) |
244 if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { | |
245 c->isfloat = rule[i].isfloat; | |
246 for(j = 0; rreg[i].tregex && j < ntags; j++) { | |
247 if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { | |
248 matched = True; | |
249 c->tags[j] = True; | |
250 } | |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
251 } |
114 | 252 } |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
253 if(ch.res_class) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
254 XFree(ch.res_class); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
255 if(ch.res_name) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
256 XFree(ch.res_name); |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
257 } |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
258 if(!matched) |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
259 for(i = 0; i < ntags; i++) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
260 c->tags[i] = seltag[i]; |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
261 } |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
262 |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
263 void |
284
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
264 tag(Arg *arg) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
265 { |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
266 unsigned int i; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
267 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
268 if(!sel) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
269 return; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
270 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
271 for(i = 0; i < ntags; i++) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
272 sel->tags[i] = False; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
273 sel->tags[arg->i] = True; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
274 settitle(sel); |
287
5e5e5392c7cb
applied sanders tag()/toggletag() fixes
Anselm R.Garbe <arg@10ksloc.org>
parents:
285
diff
changeset
|
275 if(!isvisible(sel)) |
5e5e5392c7cb
applied sanders tag()/toggletag() fixes
Anselm R.Garbe <arg@10ksloc.org>
parents:
285
diff
changeset
|
276 arrange(NULL); |
284
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
277 } |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
278 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
279 void |
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
280 togglemode(Arg *arg) |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
281 { |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
282 arrange = arrange == dofloat ? dotile : dofloat; |
306
71f02d14dce1
added general centralization rule for new clients (works around various borken apps)
Anselm R.Garbe <arg@10ksloc.org>
parents:
289
diff
changeset
|
283 if(sel) |
71f02d14dce1
added general centralization rule for new clients (works around various borken apps)
Anselm R.Garbe <arg@10ksloc.org>
parents:
289
diff
changeset
|
284 arrange(NULL); |
71f02d14dce1
added general centralization rule for new clients (works around various borken apps)
Anselm R.Garbe <arg@10ksloc.org>
parents:
289
diff
changeset
|
285 else |
71f02d14dce1
added general centralization rule for new clients (works around various borken apps)
Anselm R.Garbe <arg@10ksloc.org>
parents:
289
diff
changeset
|
286 drawstatus(); |
124
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
287 } |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
288 |
75576e44c1d8
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
arg@10ksloc.org
parents:
123
diff
changeset
|
289 void |
284
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
290 toggletag(Arg *arg) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
291 { |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
292 unsigned int i; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
293 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
294 if(!sel) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
295 return; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
296 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
297 sel->tags[arg->i] = !sel->tags[arg->i]; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
298 for(i = 0; i < ntags && !sel->tags[i]; i++); |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
299 if(i == ntags) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
300 sel->tags[arg->i] = True; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
301 settitle(sel); |
287
5e5e5392c7cb
applied sanders tag()/toggletag() fixes
Anselm R.Garbe <arg@10ksloc.org>
parents:
285
diff
changeset
|
302 if(!isvisible(sel)) |
5e5e5392c7cb
applied sanders tag()/toggletag() fixes
Anselm R.Garbe <arg@10ksloc.org>
parents:
285
diff
changeset
|
303 arrange(NULL); |
284
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
304 } |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
305 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
306 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
307 void |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
308 toggleview(Arg *arg) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
309 { |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
310 unsigned int i; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
311 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
312 seltag[arg->i] = !seltag[arg->i]; |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
313 for(i = 0; i < ntags && !seltag[i]; i++); |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
314 if(i == ntags) |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
315 seltag[arg->i] = True; /* cannot toggle last view */ |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
316 arrange(NULL); |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
317 } |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
318 |
5f5c56e104de
changed replacetag into toggletag
Anselm R.Garbe <arg@10ksloc.org>
parents:
277
diff
changeset
|
319 void |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
320 view(Arg *arg) |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
321 { |
261
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
322 unsigned int i; |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
323 |
d6fd632d861c
implement multi-tag selection through button3 click on the specific tag
Anselm R.Garbe <arg@10ksloc.org>
parents:
240
diff
changeset
|
324 for(i = 0; i < ntags; i++) |
262
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
325 seltag[i] = False; |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
326 seltag[arg->i] = True; |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
327 arrange(NULL); |
d659a2dce2b5
implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature
Anselm R.Garbe <arg@10ksloc.org>
parents:
261
diff
changeset
|
328 } |