summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranselm@anselm1 <unknown>2008-02-28 20:02:57 +0000
committeranselm@anselm1 <unknown>2008-02-28 20:02:57 +0000
commitf1719ac2de2aba270c2460807eacae137d3aeadf (patch)
tree3b61a93d8f13fb8a2162995668c799f5f28e6be6
parenta small fix to buttonpress (diff)
downloaddwm-f1719ac2de2aba270c2460807eacae137d3aeadf.tar.gz
dwm-f1719ac2de2aba270c2460807eacae137d3aeadf.zip
removed initags -- we autoselect the first tag in each view instead
-rw-r--r--config.def.h1
-rw-r--r--dwm.c55
2 files changed, 31 insertions, 25 deletions
diff --git a/config.def.h b/config.def.h
index 9ecdac5..92f1cdc 100644
--- a/config.def.h
+++ b/config.def.h
@@ -14,7 +14,6 @@
14/* old */ 14/* old */
15const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "nil", "6", "7", "8", "www" }; 15const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "nil", "6", "7", "8", "www" };
16unsigned int vtags[LENGTH(tags)] = { 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 }; 16unsigned int vtags[LENGTH(tags)] = { 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 };
17Bool initags[LENGTH(tags)] = { [0] = True, [5] = True };
18 17
19Rule rules[] = { 18Rule rules[] = {
20 /* class:instance:title substr tags ref isfloating */ 19 /* class:instance:title substr tags ref isfloating */
diff --git a/dwm.c b/dwm.c
index 60d6ea6..11a9fba 100644
--- a/dwm.c
+++ b/dwm.c
@@ -227,7 +227,6 @@ void (*handler[LASTEvent]) (XEvent *) = {
227 [UnmapNotify] = unmapnotify 227 [UnmapNotify] = unmapnotify
228}; 228};
229Atom wmatom[WMLast], netatom[NetLast]; 229Atom wmatom[WMLast], netatom[NetLast];
230Bool isxinerama = False;
231Bool domwfact = True; 230Bool domwfact = True;
232Bool dozoom = True; 231Bool dozoom = True;
233Bool otherwm, readin; 232Bool otherwm, readin;
@@ -246,6 +245,7 @@ Window root;
246 245
247/* configuration, allows nested code to access above variables */ 246/* configuration, allows nested code to access above variables */
248#include "config.h" 247#include "config.h"
248#define TAGSZ (LENGTH(tags) * sizeof(Bool))
249 249
250/* function implementations */ 250/* function implementations */
251void 251void
@@ -286,7 +286,7 @@ applyrules(Client *c) {
286 if(ch.res_name) 286 if(ch.res_name)
287 XFree(ch.res_name); 287 XFree(ch.res_name);
288 if(!matched) { 288 if(!matched) {
289 memcpy(c->tags, seltags, sizeof initags); 289 memcpy(c->tags, seltags, TAGSZ);
290 c->view = selview; 290 c->view = selview;
291 } 291 }
292} 292}
@@ -654,10 +654,8 @@ enternotify(XEvent *e) {
654 Client *c; 654 Client *c;
655 XCrossingEvent *ev = &e->xcrossing; 655 XCrossingEvent *ev = &e->xcrossing;
656 656
657 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) { 657 if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
658 if(!isxinerama || ev->window != root) 658 return;
659 return;
660 }
661 if((c = getclient(ev->window))) 659 if((c = getclient(ev->window)))
662 focus(c); 660 focus(c);
663 else 661 else
@@ -1042,7 +1040,7 @@ manage(Window w, XWindowAttributes *wa) {
1042 XWindowChanges wc; 1040 XWindowChanges wc;
1043 1041
1044 c = emallocz(sizeof(Client)); 1042 c = emallocz(sizeof(Client));
1045 c->tags = emallocz(sizeof initags); 1043 c->tags = emallocz(TAGSZ);
1046 c->win = w; 1044 c->win = w;
1047 1045
1048 applyrules(c); 1046 applyrules(c);
@@ -1082,7 +1080,7 @@ manage(Window w, XWindowAttributes *wa) {
1082 if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) 1080 if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
1083 for(t = clients; t && t->win != trans; t = t->next); 1081 for(t = clients; t && t->win != trans; t = t->next);
1084 if(t) 1082 if(t)
1085 memcpy(c->tags, t->tags, sizeof initags); 1083 memcpy(c->tags, t->tags, TAGSZ);
1086 if(!c->isfloating) 1084 if(!c->isfloating)
1087 c->isfloating = (rettrans == Success) || c->isfixed; 1085 c->isfloating = (rettrans == Success) || c->isfixed;
1088 attach(c); 1086 attach(c);
@@ -1501,7 +1499,7 @@ setmwfact(const char *arg) {
1501 1499
1502void 1500void
1503setup(void) { 1501setup(void) {
1504 unsigned int i; 1502 unsigned int i, j;
1505 View *v; 1503 View *v;
1506 XSetWindowAttributes wa; 1504 XSetWindowAttributes wa;
1507 XineramaScreenInfo *info = NULL; 1505 XineramaScreenInfo *info = NULL;
@@ -1519,10 +1517,10 @@ setup(void) {
1519 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); 1517 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
1520 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); 1518 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
1521 1519
1522 if((isxinerama = XineramaIsActive(dpy))) 1520 if(XineramaIsActive(dpy))
1523 info = XineramaQueryScreens(dpy, &nviews); 1521 info = XineramaQueryScreens(dpy, &nviews);
1522
1524#if defined(AIM_XINERAMA) 1523#if defined(AIM_XINERAMA)
1525isxinerama = True;
1526nviews = 2; /* aim Xinerama */ 1524nviews = 2; /* aim Xinerama */
1527#endif 1525#endif
1528 views = emallocz(nviews * sizeof(View)); 1526 views = emallocz(nviews * sizeof(View));
@@ -1551,16 +1549,27 @@ nviews = 2; /* aim Xinerama */
1551 blw = i; 1549 blw = i;
1552 } 1550 }
1553 1551
1554 seltags = emallocz(sizeof initags); 1552 seltags = emallocz(TAGSZ);
1555 prevtags = emallocz(sizeof initags); 1553 prevtags = emallocz(TAGSZ);
1556 memcpy(seltags, initags, sizeof initags); 1554
1557 memcpy(prevtags, initags, sizeof initags); 1555 /* check, if vtags need assistance, because there is only 1 view */
1556 if(nviews == 1)
1557 for(i = 0; i < LENGTH(tags); i++)
1558 vtags[i] = 0;
1558 1559
1559 for(i = 0; i < nviews; i++) { 1560 for(i = 0; i < nviews; i++) {
1560 /* init geometry */ 1561 /* init geometry */
1561 v = &views[i]; 1562 v = &views[i];
1562 1563
1563 if(nviews != 1 && isxinerama) { 1564 /* select first tag in each view */
1565 for(j = 0; j < LENGTH(tags); j++)
1566 if(vtags[j] == i) {
1567 seltags[j] = prevtags[j] = True;
1568 break;
1569 }
1570
1571
1572 if(info) {
1564 1573
1565#if defined(AIM_XINERAMA) 1574#if defined(AIM_XINERAMA)
1566v->w = DisplayWidth(dpy, screen) / 2; 1575v->w = DisplayWidth(dpy, screen) / 2;
@@ -1693,8 +1702,6 @@ tile(View *v) {
1693 1702
1694 for(i = 0, c = mc = nexttiled(clients, v); c; c = nexttiled(c->next, v)) { 1703 for(i = 0, c = mc = nexttiled(clients, v); c; c = nexttiled(c->next, v)) {
1695 if(i == 0) { /* master */ 1704 if(i == 0) { /* master */
1696 nx = v->wax;
1697 ny = v->way;
1698 nw = mw - 2 * c->border; 1705 nw = mw - 2 * c->border;
1699 nh = v->wah - 2 * c->border; 1706 nh = v->wah - 2 * c->border;
1700 } 1707 }
@@ -1908,9 +1915,9 @@ view(const char *arg) {
1908 tmp[i] = (NULL == arg); 1915 tmp[i] = (NULL == arg);
1909 tmp[idxoftag(arg)] = True; 1916 tmp[idxoftag(arg)] = True;
1910 1917
1911 if(memcmp(seltags, tmp, sizeof initags) != 0) { 1918 if(memcmp(seltags, tmp, TAGSZ) != 0) {
1912 memcpy(prevtags, seltags, sizeof initags); 1919 memcpy(prevtags, seltags, TAGSZ);
1913 memcpy(seltags, tmp, sizeof initags); 1920 memcpy(seltags, tmp, TAGSZ);
1914 arrange(); 1921 arrange();
1915 } 1922 }
1916} 1923}
@@ -1934,9 +1941,9 @@ void
1934viewprevtag(const char *arg) { 1941viewprevtag(const char *arg) {
1935 static Bool tmp[LENGTH(tags)]; 1942 static Bool tmp[LENGTH(tags)];
1936 1943
1937 memcpy(tmp, seltags, sizeof initags); 1944 memcpy(tmp, seltags, TAGSZ);
1938 memcpy(seltags, prevtags, sizeof initags); 1945 memcpy(seltags, prevtags, TAGSZ);
1939 memcpy(prevtags, tmp, sizeof initags); 1946 memcpy(prevtags, tmp, TAGSZ);
1940 arrange(); 1947 arrange();
1941} 1948}
1942 1949