55 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
55 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
56 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
56 enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
57 |
57 |
58 /* typedefs */ |
58 /* typedefs */ |
59 typedef struct Client Client; |
59 typedef struct Client Client; |
|
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 }; |
60 |
76 |
61 typedef struct { |
77 typedef struct { |
62 int x, y, w, h; |
78 int x, y, w, h; |
63 unsigned long norm[ColLast]; |
79 unsigned long norm[ColLast]; |
64 unsigned long sel[ColLast]; |
80 unsigned long sel[ColLast]; |
168 void unmapnotify(XEvent *e); |
184 void unmapnotify(XEvent *e); |
169 void updatebarpos(void); |
185 void updatebarpos(void); |
170 void updatesizehints(Client *c); |
186 void updatesizehints(Client *c); |
171 void updatetitle(Client *c); |
187 void updatetitle(Client *c); |
172 void view(const char *arg); |
188 void view(const char *arg); |
|
189 void viewprevtag(const char *arg); /* views previous selected tags */ |
173 int xerror(Display *dpy, XErrorEvent *ee); |
190 int xerror(Display *dpy, XErrorEvent *ee); |
174 int xerrordummy(Display *dsply, XErrorEvent *ee); |
191 int xerrordummy(Display *dsply, XErrorEvent *ee); |
175 int xerrorstart(Display *dsply, XErrorEvent *ee); |
192 int xerrorstart(Display *dsply, XErrorEvent *ee); |
176 void zoom(const char *arg); |
193 void zoom(const char *arg); |
177 |
194 |
217 #include "config.h" |
234 #include "config.h" |
218 |
235 |
219 /* Statically define the number of tags. */ |
236 /* Statically define the number of tags. */ |
220 unsigned int ntags = sizeof tags / sizeof tags[0]; |
237 unsigned int ntags = sizeof tags / sizeof tags[0]; |
221 Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True}; |
238 Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True}; |
222 |
239 Bool prevtags[sizeof tags / sizeof tags[0]] = {[0] = True}; |
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 }; |
|
238 |
240 |
239 /* functions*/ |
241 /* functions*/ |
240 void |
242 void |
241 applyrules(Client *c) { |
243 applyrules(Client *c) { |
242 static char buf[512]; |
244 static char buf[512]; |
1041 grabbuttons(c, False); |
1042 grabbuttons(c, False); |
1042 updatetitle(c); |
1043 updatetitle(c); |
1043 if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) |
1044 if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) |
1044 for(t = clients; t && t->win != trans; t = t->next); |
1045 for(t = clients; t && t->win != trans; t = t->next); |
1045 if(t) |
1046 if(t) |
1046 for(i = 0; i < ntags; i++) |
1047 memcpy(c->tags, t->tags, sizeof seltags); |
1047 c->tags[i] = t->tags[i]; |
|
1048 applyrules(c); |
1048 applyrules(c); |
1049 if(!c->isfloating) |
1049 if(!c->isfloating) |
1050 c->isfloating = (rettrans == Success) || c->isfixed; |
1050 c->isfloating = (rettrans == Success) || c->isfixed; |
1051 attach(c); |
1051 attach(c); |
1052 attachstack(c); |
1052 attachstack(c); |
1836 |
1837 |
1837 void |
1838 void |
1838 view(const char *arg) { |
1839 view(const char *arg) { |
1839 unsigned int i; |
1840 unsigned int i; |
1840 |
1841 |
|
1842 memcpy(prevtags, seltags, sizeof seltags); |
1841 for(i = 0; i < ntags; i++) |
1843 for(i = 0; i < ntags; i++) |
1842 seltags[i] = arg == NULL; |
1844 seltags[i] = arg == NULL; |
1843 i = idxoftag(arg); |
1845 i = idxoftag(arg); |
1844 if(i >= 0 && i < ntags) |
1846 if(i >= 0 && i < ntags) |
1845 seltags[i] = True; |
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 arrange(); |
1858 arrange(); |
1847 } |
1859 } |
1848 |
1860 |
1849 void |
1861 void |
1850 zoom(const char *arg) { |
1862 zoom(const char *arg) { |