diff options
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 44 |
1 files changed, 30 insertions, 14 deletions
| @@ -158,7 +158,7 @@ static void attachstack(Client *c); | |||
| 158 | static void buttonpress(XEvent *e); | 158 | static void buttonpress(XEvent *e); |
| 159 | static void checkotherwm(void); | 159 | static void checkotherwm(void); |
| 160 | static void cleanup(void); | 160 | static void cleanup(void); |
| 161 | static void cleanupmons(void); | 161 | static void cleanupmon(Monitor *mon); |
| 162 | static void clearurgent(Client *c); | 162 | static void clearurgent(Client *c); |
| 163 | static void configure(Client *c); | 163 | static void configure(Client *c); |
| 164 | static void configurenotify(XEvent *e); | 164 | static void configurenotify(XEvent *e); |
| @@ -480,22 +480,25 @@ cleanup(void) { | |||
| 480 | XFreeCursor(dpy, cursor[CurNormal]); | 480 | XFreeCursor(dpy, cursor[CurNormal]); |
| 481 | XFreeCursor(dpy, cursor[CurResize]); | 481 | XFreeCursor(dpy, cursor[CurResize]); |
| 482 | XFreeCursor(dpy, cursor[CurMove]); | 482 | XFreeCursor(dpy, cursor[CurMove]); |
| 483 | cleanupmons(); | 483 | while(mons) |
| 484 | cleanupmon(mons); | ||
| 484 | XSync(dpy, False); | 485 | XSync(dpy, False); |
| 485 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); | 486 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
| 486 | } | 487 | } |
| 487 | 488 | ||
| 488 | void | 489 | void |
| 489 | cleanupmons(void) { | 490 | cleanupmon(Monitor *mon) { |
| 490 | Monitor *m; | 491 | Monitor *m; |
| 491 | 492 | ||
| 492 | while(mons) { | 493 | if(mon == mons) |
| 493 | m = mons->next; | 494 | mons = mons->next; |
| 494 | XUnmapWindow(dpy, mons->barwin); | 495 | else { |
| 495 | XDestroyWindow(dpy, mons->barwin); | 496 | for(m = mons; m && m->next != mon; m = m->next); |
| 496 | free(mons); | 497 | m->next = mon->next; |
| 497 | mons = m; | ||
| 498 | } | 498 | } |
| 499 | XUnmapWindow(dpy, mon->barwin); | ||
| 500 | XDestroyWindow(dpy, mon->barwin); | ||
| 501 | free(mon); | ||
| 499 | } | 502 | } |
| 500 | 503 | ||
| 501 | void | 504 | void |
| @@ -1727,6 +1730,7 @@ updategeom(void) { | |||
| 1727 | #ifdef XINERAMA | 1730 | #ifdef XINERAMA |
| 1728 | if(XineramaIsActive(dpy)) { | 1731 | if(XineramaIsActive(dpy)) { |
| 1729 | int i, j, n, nn; | 1732 | int i, j, n, nn; |
| 1733 | Client *c; | ||
| 1730 | Monitor *m; | 1734 | Monitor *m; |
| 1731 | XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn); | 1735 | XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn); |
| 1732 | XineramaScreenInfo *unique = NULL; | 1736 | XineramaScreenInfo *unique = NULL; |
| @@ -1755,7 +1759,7 @@ updategeom(void) { | |||
| 1755 | || unique[i].width != m->mw || unique[i].height != m->mh)) | 1759 | || unique[i].width != m->mw || unique[i].height != m->mh)) |
| 1756 | { | 1760 | { |
| 1757 | dirty = True; | 1761 | dirty = True; |
| 1758 | m->num = unique[i].screen_number; | 1762 | m->num = i; |
| 1759 | m->mx = m->wx = unique[i].x_org; | 1763 | m->mx = m->wx = unique[i].x_org; |
| 1760 | m->my = m->wy = unique[i].y_org; | 1764 | m->my = m->wy = unique[i].y_org; |
| 1761 | m->mw = m->ww = unique[i].width; | 1765 | m->mw = m->ww = unique[i].width; |
| @@ -1763,10 +1767,22 @@ updategeom(void) { | |||
| 1763 | updatebarpos(m); | 1767 | updatebarpos(m); |
| 1764 | } | 1768 | } |
| 1765 | } | 1769 | } |
| 1766 | else { /* less monitors available */ | 1770 | else { /* less monitors available nn < n */ |
| 1767 | cleanup(); | 1771 | for(i = nn; i < n; i++) { |
| 1768 | setup(); | 1772 | for(m = mons; m && m->next; m = m->next); |
| 1769 | scan(); | 1773 | while(m->clients) { |
| 1774 | dirty = True; | ||
| 1775 | c = m->clients; | ||
| 1776 | m->clients = c->next; | ||
| 1777 | detachstack(c); | ||
| 1778 | c->mon = mons; | ||
| 1779 | attach(c); | ||
| 1780 | attachstack(c); | ||
| 1781 | } | ||
| 1782 | if(m == selmon) | ||
| 1783 | selmon = mons; | ||
| 1784 | cleanupmon(m); | ||
| 1785 | } | ||
| 1770 | } | 1786 | } |
| 1771 | free(unique); | 1787 | free(unique); |
| 1772 | } | 1788 | } |
