all repos — dwm @ f1719ac2de2aba270c2460807eacae137d3aeadf

my dwm build

removed initags -- we autoselect the first tag in each view instead
anselm@anselm1 unknown
Thu, 28 Feb 2008 20:02:57 +0000
commit

f1719ac2de2aba270c2460807eacae137d3aeadf

parent

d99ec6148258bd7933f3359ba05080e95f9ecb71

2 files changed, 31 insertions(+), 25 deletions(-)

jump to
M config.def.hconfig.def.h

@@ -14,7 +14,6 @@

/* old */ const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "nil", "6", "7", "8", "www" }; unsigned int vtags[LENGTH(tags)] = { 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 }; -Bool initags[LENGTH(tags)] = { [0] = True, [5] = True }; Rule rules[] = { /* class:instance:title substr tags ref isfloating */
M dwm.cdwm.c

@@ -227,7 +227,6 @@ [PropertyNotify] = propertynotify,

[UnmapNotify] = unmapnotify }; Atom wmatom[WMLast], netatom[NetLast]; -Bool isxinerama = False; Bool domwfact = True; Bool dozoom = True; Bool otherwm, readin;

@@ -246,6 +245,7 @@ Window root;

/* configuration, allows nested code to access above variables */ #include "config.h" +#define TAGSZ (LENGTH(tags) * sizeof(Bool)) /* function implementations */ void

@@ -286,7 +286,7 @@ XFree(ch.res_class);

if(ch.res_name) XFree(ch.res_name); if(!matched) { - memcpy(c->tags, seltags, sizeof initags); + memcpy(c->tags, seltags, TAGSZ); c->view = selview; } }

@@ -654,10 +654,8 @@ enternotify(XEvent *e) {

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

@@ -1042,7 +1040,7 @@ Window trans;

XWindowChanges wc; c = emallocz(sizeof(Client)); - c->tags = emallocz(sizeof initags); + c->tags = emallocz(TAGSZ); c->win = w; applyrules(c);

@@ -1082,7 +1080,7 @@ updatetitle(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);

@@ -1501,7 +1499,7 @@ }

void setup(void) { - unsigned int i; + unsigned int i, j; View *v; XSetWindowAttributes wa; XineramaScreenInfo *info = NULL;

@@ -1519,10 +1517,10 @@ wa.cursor = cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);

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));

@@ -1551,16 +1549,27 @@ if(i > blw)

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;

@@ -1693,8 +1702,6 @@ th = v->wah;

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; }

@@ -1908,9 +1915,9 @@ for(i = 0; i < LENGTH(tags); i++)

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(); } }

@@ -1934,9 +1941,9 @@ void

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(); }