Update monitor positions also on removal
When monitors are removed, the coordinates of existing monitors may change, if the removed monitors had smaller coordinates than the remaining ones. Remove special case handling so that the same update-if-necessary loop is run also in the case when monitors are removed.
This commit is contained in:
parent
8806b6e237
commit
d93ff48803
1 changed files with 34 additions and 34 deletions
8
dwm.c
8
dwm.c
|
@ -1876,8 +1876,9 @@ updategeom(void)
|
|||
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
||||
XFree(info);
|
||||
nn = j;
|
||||
if (n <= nn) { /* new monitors available */
|
||||
for (i = 0; i < (nn - n); i++) {
|
||||
|
||||
/* new monitors if nn > n */
|
||||
for (i = n; i < nn; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = createmon();
|
||||
|
@ -1897,7 +1898,7 @@ updategeom(void)
|
|||
m->mh = m->wh = unique[i].height;
|
||||
updatebarpos(m);
|
||||
}
|
||||
} else { /* less monitors available nn < n */
|
||||
/* removed monitors if n > nn */
|
||||
for (i = nn; i < n; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
while ((c = m->clients)) {
|
||||
|
@ -1912,7 +1913,6 @@ updategeom(void)
|
|||
selmon = mons;
|
||||
cleanupmon(m);
|
||||
}
|
||||
}
|
||||
free(unique);
|
||||
} else
|
||||
#endif /* XINERAMA */
|
||||
|
|
Loading…
Reference in a new issue