diff options
| -rw-r--r-- | dwm.c | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -117,7 +117,6 @@ typedef struct { | |||
| 117 | } Regs; | 117 | } Regs; |
| 118 | 118 | ||
| 119 | typedef struct { | 119 | typedef struct { |
| 120 | int monitor; | ||
| 121 | Window barwin; | 120 | Window barwin; |
| 122 | int sx, sy, sw, sh, wax, way, wah, waw; | 121 | int sx, sy, sw, sh, wax, way, wah, waw; |
| 123 | Bool *seltags; | 122 | Bool *seltags; |
| @@ -1164,11 +1163,13 @@ void | |||
| 1164 | movemouse(Client *c) { | 1163 | movemouse(Client *c) { |
| 1165 | int x1, y1, ocx, ocy, di, nx, ny; | 1164 | int x1, y1, ocx, ocy, di, nx, ny; |
| 1166 | unsigned int dui; | 1165 | unsigned int dui; |
| 1166 | Monitor *m; | ||
| 1167 | Window dummy; | 1167 | Window dummy; |
| 1168 | XEvent ev; | 1168 | XEvent ev; |
| 1169 | 1169 | ||
| 1170 | ocx = nx = c->x; | 1170 | ocx = nx = c->x; |
| 1171 | ocy = ny = c->y; | 1171 | ocy = ny = c->y; |
| 1172 | m = &monitors[c->monitor]; | ||
| 1172 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, | 1173 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
| 1173 | None, cursor[CurMove], CurrentTime) != GrabSuccess) | 1174 | None, cursor[CurMove], CurrentTime) != GrabSuccess) |
| 1174 | return; | 1175 | return; |
| @@ -1188,7 +1189,6 @@ movemouse(Client *c) { | |||
| 1188 | XSync(dpy, False); | 1189 | XSync(dpy, False); |
| 1189 | nx = ocx + (ev.xmotion.x - x1); | 1190 | nx = ocx + (ev.xmotion.x - x1); |
| 1190 | ny = ocy + (ev.xmotion.y - y1); | 1191 | ny = ocy + (ev.xmotion.y - y1); |
| 1191 | Monitor *m = &monitors[monitorat()]; | ||
| 1192 | if(abs(m->wax - nx) < SNAP) | 1192 | if(abs(m->wax - nx) < SNAP) |
| 1193 | nx = m->wax; | 1193 | nx = m->wax; |
| 1194 | else if(abs((m->wax + m->waw) - (nx + c->w + 2 * c->border)) < SNAP) | 1194 | else if(abs((m->wax + m->waw) - (nx + c->w + 2 * c->border)) < SNAP) |
| @@ -1197,11 +1197,10 @@ movemouse(Client *c) { | |||
| 1197 | ny = m->way; | 1197 | ny = m->way; |
| 1198 | else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP) | 1198 | else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP) |
| 1199 | ny = m->way + m->wah - c->h - 2 * c->border; | 1199 | ny = m->way + m->wah - c->h - 2 * c->border; |
| 1200 | if((monitors[selmonitor].layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) | 1200 | if((m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) |
| 1201 | togglefloating(NULL); | 1201 | togglefloating(NULL); |
| 1202 | if((monitors[selmonitor].layout->arrange == floating) || c->isfloating) | 1202 | if((m->layout->arrange == floating) || c->isfloating) |
| 1203 | resize(c, nx, ny, c->w, c->h, False); | 1203 | resize(c, nx, ny, c->w, c->h, False); |
| 1204 | memcpy(c->tags, monitors[monitorat()].seltags, sizeof initags); | ||
| 1205 | break; | 1204 | break; |
| 1206 | } | 1205 | } |
| 1207 | } | 1206 | } |
| @@ -1335,10 +1334,12 @@ void | |||
| 1335 | resizemouse(Client *c) { | 1334 | resizemouse(Client *c) { |
| 1336 | int ocx, ocy; | 1335 | int ocx, ocy; |
| 1337 | int nw, nh; | 1336 | int nw, nh; |
| 1337 | Monitor *m; | ||
| 1338 | XEvent ev; | 1338 | XEvent ev; |
| 1339 | 1339 | ||
| 1340 | ocx = c->x; | 1340 | ocx = c->x; |
| 1341 | ocy = c->y; | 1341 | ocy = c->y; |
| 1342 | m = &monitors[c->monitor]; | ||
| 1342 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, | 1343 | if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
| 1343 | None, cursor[CurResize], CurrentTime) != GrabSuccess) | 1344 | None, cursor[CurResize], CurrentTime) != GrabSuccess) |
| 1344 | return; | 1345 | return; |
| @@ -1363,9 +1364,9 @@ resizemouse(Client *c) { | |||
| 1363 | nw = 1; | 1364 | nw = 1; |
| 1364 | if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) | 1365 | if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) |
| 1365 | nh = 1; | 1366 | nh = 1; |
| 1366 | if((monitors[selmonitor].layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) | 1367 | if((m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) |
| 1367 | togglefloating(NULL); | 1368 | togglefloating(NULL); |
| 1368 | if((monitors[selmonitor].layout->arrange == floating) || c->isfloating) | 1369 | if((m->layout->arrange == floating) || c->isfloating) |
| 1369 | resize(c, c->x, c->y, nw, nh, True); | 1370 | resize(c, c->x, c->y, nw, nh, True); |
| 1370 | break; | 1371 | break; |
| 1371 | } | 1372 | } |
| @@ -1600,8 +1601,6 @@ setup(void) { | |||
| 1600 | /* init geometry */ | 1601 | /* init geometry */ |
| 1601 | m = &monitors[i]; | 1602 | m = &monitors[i]; |
| 1602 | 1603 | ||
| 1603 | m->monitor = i; | ||
| 1604 | |||
| 1605 | if (mcount != 1 && isxinerama) { | 1604 | if (mcount != 1 && isxinerama) { |
| 1606 | m->sx = info[i].x_org; | 1605 | m->sx = info[i].x_org; |
| 1607 | m->sy = info[i].y_org; | 1606 | m->sy = info[i].y_org; |
