[UnmapNotify] = unmapnotify
};
Atom wmatom[WMLast], netatom[NetLast];
-Bool isxinerama = False;
Bool domwfact = True;
Bool dozoom = True;
Bool otherwm, readin;
/* configuration, allows nested code to access above variables */
#include "config.h"
+#define TAGSZ (LENGTH(tags) * sizeof(Bool))
/* function implementations */
void
if(ch.res_name)
XFree(ch.res_name);
if(!matched) {
- memcpy(c->tags, seltags, sizeof initags);
+ memcpy(c->tags, seltags, TAGSZ);
c->view = selview;
}
}
Client *c;
XCrossingEvent *ev = &e->xcrossing;
- if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) {
- if(!isxinerama || ev->window != root)
- return;
- }
+ if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
+ return;
if((c = getclient(ev->window)))
focus(c);
else
XWindowChanges wc;
c = emallocz(sizeof(Client));
- c->tags = emallocz(sizeof initags);
+ c->tags = emallocz(TAGSZ);
c->win = w;
applyrules(c);
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
for(t = clients; t && t->win != trans; t = t->next);
if(t)
- memcpy(c->tags, t->tags, sizeof initags);
+ memcpy(c->tags, t->tags, TAGSZ);
if(!c->isfloating)
c->isfloating = (rettrans == Success) || c->isfixed;
attach(c);
void
setup(void) {
- unsigned int i;
+ unsigned int i, j;
View *v;
XSetWindowAttributes wa;
XineramaScreenInfo *info = NULL;
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
- if((isxinerama = XineramaIsActive(dpy)))
+ if(XineramaIsActive(dpy))
info = XineramaQueryScreens(dpy, &nviews);
+
#if defined(AIM_XINERAMA)
-isxinerama = True;
nviews = 2; /* aim Xinerama */
#endif
views = emallocz(nviews * sizeof(View));
blw = i;
}
- seltags = emallocz(sizeof initags);
- prevtags = emallocz(sizeof initags);
- memcpy(seltags, initags, sizeof initags);
- memcpy(prevtags, initags, sizeof initags);
+ seltags = emallocz(TAGSZ);
+ prevtags = emallocz(TAGSZ);
+
+ /* check, if vtags need assistance, because there is only 1 view */
+ if(nviews == 1)
+ for(i = 0; i < LENGTH(tags); i++)
+ vtags[i] = 0;
for(i = 0; i < nviews; i++) {
/* init geometry */
v = &views[i];
- if(nviews != 1 && isxinerama) {
+ /* select first tag in each view */
+ for(j = 0; j < LENGTH(tags); j++)
+ if(vtags[j] == i) {
+ seltags[j] = prevtags[j] = True;
+ break;
+ }
+
+
+ if(info) {
#if defined(AIM_XINERAMA)
v->w = DisplayWidth(dpy, screen) / 2;
for(i = 0, c = mc = nexttiled(clients, v); c; c = nexttiled(c->next, v)) {
if(i == 0) { /* master */
- nx = v->wax;
- ny = v->way;
nw = mw - 2 * c->border;
nh = v->wah - 2 * c->border;
}
tmp[i] = (NULL == arg);
tmp[idxoftag(arg)] = True;
- if(memcmp(seltags, tmp, sizeof initags) != 0) {
- memcpy(prevtags, seltags, sizeof initags);
- memcpy(seltags, tmp, sizeof initags);
+ if(memcmp(seltags, tmp, TAGSZ) != 0) {
+ memcpy(prevtags, seltags, TAGSZ);
+ memcpy(seltags, tmp, TAGSZ);
arrange();
}
}
viewprevtag(const char *arg) {
static Bool tmp[LENGTH(tags)];
- memcpy(tmp, seltags, sizeof initags);
- memcpy(seltags, prevtags, sizeof initags);
- memcpy(prevtags, tmp, sizeof initags);
+ memcpy(tmp, seltags, TAGSZ);
+ memcpy(seltags, prevtags, TAGSZ);
+ memcpy(prevtags, tmp, TAGSZ);
arrange();
}