} Regs;
typedef struct {
- int monitor;
Window barwin;
int sx, sy, sw, sh, wax, way, wah, waw;
Bool *seltags;
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;
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)
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;
}
}
void
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
+ Monitor *m;
XWindowChanges wc;
- //Monitor scr = monitors[monitorat()];
-// c->monitor = monitorat();
+
+ m = &monitors[c->monitor];
if(sizehints) {
/* set minimum possible */
}
if(w <= 0 || h <= 0)
return;
- /* TODO: offscreen appearance fixes */
- /*
- if(x > scr.sw)
- x = scr.sw - w - 2 * c->border;
- if(y > scr.sh)
- y = scr.sh - h - 2 * c->border;
- if(x + w + 2 * c->border < scr.sx)
- x = scr.sx;
- if(y + h + 2 * c->border < scr.sy)
- y = scr.sy;
- */
+ if(x > m->sw)
+ x = m->sw - w - 2 * c->border;
+ if(y > m->sh)
+ y = m->sh - h - 2 * c->border;
+ if(x + w + 2 * c->border < m->sx)
+ x = m->sx;
+ if(y + h + 2 * c->border < m->sy)
+ y = m->sy;
if(c->x != x || c->y != y || c->w != w || c->h != h) {
c->x = wc.x = x;
c->y = wc.y = y;
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;
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;
}
/* init geometry */
m = &monitors[i];
- m->monitor = i;
-
if (mcount != 1 && isxinerama) {
m->sx = info[i].x_org;
m->sy = info[i].y_org;
void
zoom(const char *arg) {
- Client *c;
+ Client *c = sel;
if(!sel || !dozoom || sel->isfloating)
return;
- if((c = sel) == nexttiled(clients, c->monitor))
+ if(c == nexttiled(clients, c->monitor))
if(!(c = nexttiled(c->next, c->monitor)))
return;
detach(c);