| 58 |
58 |
|
/* typedefs */ |
| 59 |
59 |
|
typedef struct Client Client; |
| 60 |
60 |
|
|
|
61 |
+ |
struct Client { |
|
62 |
+ |
char name[256]; |
|
63 |
+ |
int x, y, w, h; |
|
64 |
+ |
int rx, ry, rw, rh; /* revert geometry */ |
|
65 |
+ |
int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
|
66 |
+ |
int minax, maxax, minay, maxay; |
|
67 |
+ |
long flags; |
|
68 |
+ |
unsigned int border, oldborder; |
|
69 |
+ |
Bool isbanned, isfixed, ismax, isfloating, wasfloating; |
|
70 |
+ |
Bool *tags; |
|
71 |
+ |
Client *next; |
|
72 |
+ |
Client *prev; |
|
73 |
+ |
Client *snext; |
|
74 |
+ |
Window win; |
|
75 |
+ |
}; |
|
76 |
+ |
|
| 61 |
77 |
|
typedef struct { |
| 62 |
78 |
|
int x, y, w, h; |
| 63 |
79 |
|
unsigned long norm[ColLast]; |
|
| 170 |
186 |
|
void updatesizehints(Client *c); |
| 171 |
187 |
|
void updatetitle(Client *c); |
| 172 |
188 |
|
void view(const char *arg); |
|
189 |
+ |
void viewprevtag(const char *arg); /* views previous selected tags */ |
| 173 |
190 |
|
int xerror(Display *dpy, XErrorEvent *ee); |
| 174 |
191 |
|
int xerrordummy(Display *dsply, XErrorEvent *ee); |
| 175 |
192 |
|
int xerrorstart(Display *dsply, XErrorEvent *ee); |
|
| 219 |
236 |
|
/* Statically define the number of tags. */ |
| 220 |
237 |
|
unsigned int ntags = sizeof tags / sizeof tags[0]; |
| 221 |
238 |
|
Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True}; |
| 222 |
|
- |
|
| 223 |
|
- |
struct Client { |
| 224 |
|
- |
char name[256]; |
| 225 |
|
- |
int x, y, w, h; |
| 226 |
|
- |
int rx, ry, rw, rh; /* revert geometry */ |
| 227 |
|
- |
int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
| 228 |
|
- |
int minax, maxax, minay, maxay; |
| 229 |
|
- |
long flags; |
| 230 |
|
- |
unsigned int border, oldborder; |
| 231 |
|
- |
Bool isbanned, isfixed, ismax, isfloating, wasfloating; |
| 232 |
|
- |
Bool tags[sizeof tags / sizeof tags[0]]; |
| 233 |
|
- |
Client *next; |
| 234 |
|
- |
Client *prev; |
| 235 |
|
- |
Client *snext; |
| 236 |
|
- |
Window win; |
| 237 |
|
- |
}; |
|
239 |
+ |
Bool prevtags[sizeof tags / sizeof tags[0]] = {[0] = True}; |
| 238 |
240 |
|
|
| 239 |
241 |
|
/* functions*/ |
| 240 |
242 |
|
void |
|
| 265 |
267 |
|
if(ch.res_name) |
| 266 |
268 |
|
XFree(ch.res_name); |
| 267 |
269 |
|
if(!matched) |
| 268 |
|
- |
for(i = 0; i < ntags; i++) |
| 269 |
|
- |
c->tags[i] = seltags[i]; |
|
270 |
+ |
memcpy(c->tags, seltags, sizeof seltags); |
| 270 |
271 |
|
} |
| 271 |
272 |
|
|
| 272 |
273 |
|
void |
|
| 1002 |
1003 |
|
|
| 1003 |
1004 |
|
void |
| 1004 |
1005 |
|
manage(Window w, XWindowAttributes *wa) { |
| 1005 |
|
- |
unsigned int i; |
| 1006 |
1006 |
|
Client *c, *t = NULL; |
| 1007 |
1007 |
|
Window trans; |
| 1008 |
1008 |
|
Status rettrans; |
| 1009 |
1009 |
|
XWindowChanges wc; |
| 1010 |
1010 |
|
|
| 1011 |
1011 |
|
c = emallocz(sizeof(Client)); |
|
1012 |
+ |
c->tags = emallocz(sizeof seltags); |
| 1012 |
1013 |
|
c->win = w; |
| 1013 |
1014 |
|
c->x = wa->x; |
| 1014 |
1015 |
|
c->y = wa->y; |
|
| 1043 |
1044 |
|
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) |
| 1044 |
1045 |
|
for(t = clients; t && t->win != trans; t = t->next); |
| 1045 |
1046 |
|
if(t) |
| 1046 |
|
- |
for(i = 0; i < ntags; i++) |
| 1047 |
|
- |
c->tags[i] = t->tags[i]; |
|
1047 |
+ |
memcpy(c->tags, t->tags, sizeof seltags); |
| 1048 |
1048 |
|
applyrules(c); |
| 1049 |
1049 |
|
if(!c->isfloating) |
| 1050 |
1050 |
|
c->isfloating = (rettrans == Success) || c->isfixed; |
|
| 1702 |
1702 |
|
focus(NULL); |
| 1703 |
1703 |
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
| 1704 |
1704 |
|
setclientstate(c, WithdrawnState); |
|
1705 |
+ |
free(c->tags); |
| 1705 |
1706 |
|
free(c); |
| 1706 |
1707 |
|
XSync(dpy, False); |
| 1707 |
1708 |
|
XSetErrorHandler(xerror); |
|
| 1838 |
1839 |
|
view(const char *arg) { |
| 1839 |
1840 |
|
unsigned int i; |
| 1840 |
1841 |
|
|
|
1842 |
+ |
memcpy(prevtags, seltags, sizeof seltags); |
| 1841 |
1843 |
|
for(i = 0; i < ntags; i++) |
| 1842 |
1844 |
|
seltags[i] = arg == NULL; |
| 1843 |
1845 |
|
i = idxoftag(arg); |
| 1844 |
1846 |
|
if(i >= 0 && i < ntags) |
| 1845 |
1847 |
|
seltags[i] = True; |
|
1848 |
+ |
arrange(); |
|
1849 |
+ |
} |
|
1850 |
+ |
|
|
1851 |
+ |
void |
|
1852 |
+ |
viewprevtag(const char *arg) { |
|
1853 |
+ |
static Bool tmptags[sizeof tags / sizeof tags[0]]; |
|
1854 |
+ |
|
|
1855 |
+ |
memcpy(tmptags, seltags, sizeof seltags); |
|
1856 |
+ |
memcpy(seltags, prevtags, sizeof seltags); |
|
1857 |
+ |
memcpy(prevtags, tmptags, sizeof seltags); |
| 1846 |
1858 |
|
arrange(); |
| 1847 |
1859 |
|
} |
| 1848 |
1860 |
|
|