diff options
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 55 |
1 files changed, 31 insertions, 24 deletions
| @@ -227,7 +227,6 @@ void (*handler[LASTEvent]) (XEvent *) = { | |||
| 227 | [UnmapNotify] = unmapnotify | 227 | [UnmapNotify] = unmapnotify |
| 228 | }; | 228 | }; |
| 229 | Atom wmatom[WMLast], netatom[NetLast]; | 229 | Atom wmatom[WMLast], netatom[NetLast]; |
| 230 | Bool isxinerama = False; | ||
| 231 | Bool domwfact = True; | 230 | Bool domwfact = True; |
| 232 | Bool dozoom = True; | 231 | Bool dozoom = True; |
| 233 | Bool otherwm, readin; | 232 | Bool 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 */ |
| 251 | void | 251 | void |
| @@ -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 | ||
| 1502 | void | 1500 | void |
| 1503 | setup(void) { | 1501 | setup(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) |
| 1525 | isxinerama = True; | ||
| 1526 | nviews = 2; /* aim Xinerama */ | 1524 | nviews = 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) |
| 1566 | v->w = DisplayWidth(dpy, screen) / 2; | 1575 | v->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 | |||
| 1934 | viewprevtag(const char *arg) { | 1941 | viewprevtag(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 | ||
