made arrange() Monitor-dependent as well, fixed the movemouse/resizemouse issues
dd218235
1 file(s) · +28 −24
| 130 | 130 | ||
| 131 | 131 | /* function declarations */ |
|
| 132 | 132 | void applyrules(Client *c); |
|
| 133 | - | void arrange(void); |
|
| 133 | + | void arrange(Monitor *m); |
|
| 134 | 134 | void attach(Client *c); |
|
| 135 | 135 | void attachstack(Client *c); |
|
| 136 | 136 | void ban(Client *c); |
|
| 299 | 299 | } |
|
| 300 | 300 | ||
| 301 | 301 | void |
|
| 302 | - | arrange(void) { |
|
| 302 | + | arrange(Monitor *m) { |
|
| 303 | + | unsigned int i; |
|
| 303 | 304 | Client *c; |
|
| 304 | 305 | ||
| 305 | 306 | for(c = clients; c; c = c->next) |
|
| 308 | 309 | else |
|
| 309 | 310 | ban(c); |
|
| 310 | 311 | ||
| 311 | - | selmonitor->layout->arrange(selmonitor); |
|
| 312 | + | if(m) |
|
| 313 | + | m->layout->arrange(m); |
|
| 314 | + | else |
|
| 315 | + | for(i = 0; i < mcount; i++) |
|
| 316 | + | m->layout->arrange(&monitors[i]); |
|
| 312 | 317 | focus(NULL); |
|
| 313 | - | restack(selmonitor); |
|
| 318 | + | restack(m); |
|
| 314 | 319 | } |
|
| 315 | 320 | ||
| 316 | 321 | void |
|
| 485 | 490 | dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(root, screen), bh, DefaultDepth(dpy, screen)); |
|
| 486 | 491 | XResizeWindow(dpy, m->barwin, m->sw, bh); |
|
| 487 | 492 | updatebarpos(m); |
|
| 488 | - | arrange(); |
|
| 493 | + | arrange(m); |
|
| 489 | 494 | } |
|
| 490 | 495 | } |
|
| 491 | 496 | ||
| 1078 | 1083 | ||
| 1079 | 1084 | applyrules(c); |
|
| 1080 | 1085 | ||
| 1081 | - | m = selmonitor; |
|
| 1086 | + | m = c->monitor; |
|
| 1082 | 1087 | ||
| 1083 | 1088 | c->x = wa->x + m->sx; |
|
| 1084 | 1089 | c->y = wa->y + m->sy; |
|
| 1122 | 1127 | ban(c); |
|
| 1123 | 1128 | XMapWindow(dpy, c->win); |
|
| 1124 | 1129 | setclientstate(c, NormalState); |
|
| 1125 | - | arrange(); |
|
| 1130 | + | arrange(m); |
|
| 1126 | 1131 | } |
|
| 1127 | 1132 | ||
| 1128 | 1133 | void |
|
| 1201 | 1206 | ny = m->way; |
|
| 1202 | 1207 | else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP) |
|
| 1203 | 1208 | ny = m->way + m->wah - c->h - 2 * c->border; |
|
| 1204 | - | if((m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) |
|
| 1209 | + | if(!c->isfloating && (m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) |
|
| 1205 | 1210 | togglefloating(NULL); |
|
| 1206 | 1211 | if((m->layout->arrange == floating) || c->isfloating) |
|
| 1207 | 1212 | resize(c, nx, ny, c->w, c->h, False); |
|
| 1230 | 1235 | case XA_WM_TRANSIENT_FOR: |
|
| 1231 | 1236 | XGetTransientForHint(dpy, c->win, &trans); |
|
| 1232 | 1237 | if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL))) |
|
| 1233 | - | arrange(); |
|
| 1238 | + | arrange(c->monitor); |
|
| 1234 | 1239 | break; |
|
| 1235 | 1240 | case XA_WM_NORMAL_HINTS: |
|
| 1236 | 1241 | updatesizehints(c); |
|
| 1262 | 1267 | memcpy(c->tags, zerotags, sizeof zerotags); |
|
| 1263 | 1268 | applyrules(c); |
|
| 1264 | 1269 | } |
|
| 1265 | - | arrange(); |
|
| 1270 | + | arrange(NULL); |
|
| 1266 | 1271 | } |
|
| 1267 | 1272 | ||
| 1268 | 1273 | void |
|
| 1366 | 1371 | nw = 1; |
|
| 1367 | 1372 | if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) |
|
| 1368 | 1373 | nh = 1; |
|
| 1369 | - | if((m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) |
|
| 1374 | + | if(!c->isfloating && (m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) |
|
| 1370 | 1375 | togglefloating(NULL); |
|
| 1371 | 1376 | if((m->layout->arrange == floating) || c->isfloating) |
|
| 1372 | 1377 | resize(c, c->x, c->y, nw, nh, True); |
|
| 1518 | 1523 | m->layout = &layouts[i]; |
|
| 1519 | 1524 | } |
|
| 1520 | 1525 | if(sel) |
|
| 1521 | - | arrange(); |
|
| 1526 | + | arrange(m); |
|
| 1522 | 1527 | else |
|
| 1523 | 1528 | drawbar(m); |
|
| 1524 | 1529 | } |
|
| 1544 | 1549 | else if(m->mwfact > 0.9) |
|
| 1545 | 1550 | m->mwfact = 0.9; |
|
| 1546 | 1551 | } |
|
| 1547 | - | arrange(); |
|
| 1552 | + | arrange(m); |
|
| 1548 | 1553 | } |
|
| 1549 | 1554 | ||
| 1550 | 1555 | void |
|
| 1697 | 1702 | for(i = 0; i < LENGTH(tags); i++) |
|
| 1698 | 1703 | sel->tags[i] = (NULL == arg); |
|
| 1699 | 1704 | sel->tags[idxoftag(arg)] = True; |
|
| 1700 | - | arrange(); |
|
| 1705 | + | arrange(sel->monitor); |
|
| 1701 | 1706 | } |
|
| 1702 | 1707 | ||
| 1703 | 1708 | unsigned int |
|
| 1769 | 1774 | else |
|
| 1770 | 1775 | bpos = BarOff; |
|
| 1771 | 1776 | updatebarpos(monitorat()); |
|
| 1772 | - | arrange(); |
|
| 1777 | + | arrange(monitorat()); |
|
| 1773 | 1778 | } |
|
| 1774 | 1779 | ||
| 1775 | 1780 | void |
|
| 1779 | 1784 | sel->isfloating = !sel->isfloating; |
|
| 1780 | 1785 | if(sel->isfloating) |
|
| 1781 | 1786 | resize(sel, sel->x, sel->y, sel->w, sel->h, True); |
|
| 1782 | - | arrange(); |
|
| 1787 | + | arrange(sel->monitor); |
|
| 1783 | 1788 | } |
|
| 1784 | 1789 | ||
| 1785 | 1790 | void |
|
| 1793 | 1798 | for(j = 0; j < LENGTH(tags) && !sel->tags[j]; j++); |
|
| 1794 | 1799 | if(j == LENGTH(tags)) |
|
| 1795 | 1800 | sel->tags[i] = True; /* at least one tag must be enabled */ |
|
| 1796 | - | arrange(); |
|
| 1801 | + | arrange(sel->monitor); |
|
| 1797 | 1802 | } |
|
| 1798 | 1803 | ||
| 1799 | 1804 | void |
|
| 1800 | 1805 | toggleview(const char *arg) { |
|
| 1801 | 1806 | unsigned int i, j; |
|
| 1802 | - | ||
| 1803 | 1807 | Monitor *m = monitorat(); |
|
| 1804 | 1808 | ||
| 1805 | 1809 | i = idxoftag(arg); |
|
| 1807 | 1811 | for(j = 0; j < LENGTH(tags) && !m->seltags[j]; j++); |
|
| 1808 | 1812 | if(j == LENGTH(tags)) |
|
| 1809 | 1813 | m->seltags[i] = True; /* at least one tag must be viewed */ |
|
| 1810 | - | arrange(); |
|
| 1814 | + | arrange(m); |
|
| 1811 | 1815 | } |
|
| 1812 | 1816 | ||
| 1813 | 1817 | void |
|
| 1838 | 1842 | XSync(dpy, False); |
|
| 1839 | 1843 | XSetErrorHandler(xerror); |
|
| 1840 | 1844 | XUngrabServer(dpy); |
|
| 1841 | - | arrange(); |
|
| 1845 | + | arrange(NULL); |
|
| 1842 | 1846 | } |
|
| 1843 | 1847 | ||
| 1844 | 1848 | void |
|
| 1988 | 1992 | if(memcmp(m->seltags, tmp, sizeof initags) != 0) { |
|
| 1989 | 1993 | memcpy(m->prevtags, m->seltags, sizeof initags); |
|
| 1990 | 1994 | memcpy(m->seltags, tmp, sizeof initags); |
|
| 1991 | - | arrange(); |
|
| 1995 | + | arrange(m); |
|
| 1992 | 1996 | } |
|
| 1993 | 1997 | } |
|
| 1994 | 1998 | ||
| 2001 | 2005 | memcpy(tmp, m->seltags, sizeof initags); |
|
| 2002 | 2006 | memcpy(m->seltags, m->prevtags, sizeof initags); |
|
| 2003 | 2007 | memcpy(m->prevtags, tmp, sizeof initags); |
|
| 2004 | - | arrange(); |
|
| 2008 | + | arrange(m); |
|
| 2005 | 2009 | } |
|
| 2006 | 2010 | ||
| 2007 | 2011 | void |
|
| 2016 | 2020 | detach(c); |
|
| 2017 | 2021 | attach(c); |
|
| 2018 | 2022 | focus(c); |
|
| 2019 | - | arrange(); |
|
| 2023 | + | arrange(c->monitor); |
|
| 2020 | 2024 | } |
|
| 2021 | 2025 | ||
| 2022 | 2026 | void |
|
| 2035 | 2039 | ||
| 2036 | 2040 | memcpy(sel->tags, sel->monitor->seltags, sizeof initags); |
|
| 2037 | 2041 | resize(sel, sel->monitor->wax, sel->monitor->way, sel->w, sel->h, True); |
|
| 2038 | - | arrange(); |
|
| 2042 | + | arrange(sel->monitor); |
|
| 2039 | 2043 | } |
|
| 2040 | 2044 | ||
| 2041 | 2045 | void |
|