From ca3e847e459e1ba43f45513877d39d50cce7a0c5 Mon Sep 17 00:00:00 2001 From: Anselm R Garbe Date: Wed, 20 Feb 2008 08:09:26 +0000 Subject: applied some necessary changes --- dwm.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dwm.c b/dwm.c index 11f2293..0a1ade2 100644 --- a/dwm.c +++ b/dwm.c @@ -117,7 +117,6 @@ typedef struct { } Regs; typedef struct { - int monitor; Window barwin; int sx, sy, sw, sh, wax, way, wah, waw; Bool *seltags; @@ -1164,11 +1163,13 @@ void movemouse(Client *c) { int x1, y1, ocx, ocy, di, nx, ny; unsigned int dui; + Monitor *m; Window dummy; XEvent ev; ocx = nx = c->x; ocy = ny = c->y; + m = &monitors[c->monitor]; if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, cursor[CurMove], CurrentTime) != GrabSuccess) return; @@ -1188,7 +1189,6 @@ movemouse(Client *c) { XSync(dpy, False); nx = ocx + (ev.xmotion.x - x1); ny = ocy + (ev.xmotion.y - y1); - Monitor *m = &monitors[monitorat()]; if(abs(m->wax - nx) < SNAP) nx = m->wax; else if(abs((m->wax + m->waw) - (nx + c->w + 2 * c->border)) < SNAP) @@ -1197,11 +1197,10 @@ movemouse(Client *c) { ny = m->way; else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP) ny = m->way + m->wah - c->h - 2 * c->border; - if((monitors[selmonitor].layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) + if((m->layout->arrange != floating) && (abs(nx - c->x) > SNAP || abs(ny - c->y) > SNAP)) togglefloating(NULL); - if((monitors[selmonitor].layout->arrange == floating) || c->isfloating) + if((m->layout->arrange == floating) || c->isfloating) resize(c, nx, ny, c->w, c->h, False); - memcpy(c->tags, monitors[monitorat()].seltags, sizeof initags); break; } } @@ -1335,10 +1334,12 @@ void resizemouse(Client *c) { int ocx, ocy; int nw, nh; + Monitor *m; XEvent ev; ocx = c->x; ocy = c->y; + m = &monitors[c->monitor]; if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, cursor[CurResize], CurrentTime) != GrabSuccess) return; @@ -1363,9 +1364,9 @@ resizemouse(Client *c) { nw = 1; if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0) nh = 1; - if((monitors[selmonitor].layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) + if((m->layout->arrange != floating) && (abs(nw - c->w) > SNAP || abs(nh - c->h) > SNAP)) togglefloating(NULL); - if((monitors[selmonitor].layout->arrange == floating) || c->isfloating) + if((m->layout->arrange == floating) || c->isfloating) resize(c, c->x, c->y, nw, nh, True); break; } @@ -1600,8 +1601,6 @@ setup(void) { /* init geometry */ m = &monitors[i]; - m->monitor = i; - if (mcount != 1 && isxinerama) { m->sx = info[i].x_org; m->sy = info[i].y_org; -- cgit v1.2.3-70-g09d2