applied some necessary changes
This commit is contained in:
parent
c2737b7b93
commit
ca3e847e45
17
dwm.c
17
dwm.c
|
@ -117,7 +117,6 @@ typedef struct {
|
||||||
} Regs;
|
} Regs;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int monitor;
|
|
||||||
Window barwin;
|
Window barwin;
|
||||||
int sx, sy, sw, sh, wax, way, wah, waw;
|
int sx, sy, sw, sh, wax, way, wah, waw;
|
||||||
Bool *seltags;
|
Bool *seltags;
|
||||||
|
@ -1164,11 +1163,13 @@ void
|
||||||
movemouse(Client *c) {
|
movemouse(Client *c) {
|
||||||
int x1, y1, ocx, ocy, di, nx, ny;
|
int x1, y1, ocx, ocy, di, nx, ny;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
|
Monitor *m;
|
||||||
Window dummy;
|
Window dummy;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
ocx = nx = c->x;
|
ocx = nx = c->x;
|
||||||
ocy = ny = c->y;
|
ocy = ny = c->y;
|
||||||
|
m = &monitors[c->monitor];
|
||||||
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, cursor[CurMove], CurrentTime) != GrabSuccess)
|
None, cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
|
@ -1188,7 +1189,6 @@ movemouse(Client *c) {
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
nx = ocx + (ev.xmotion.x - x1);
|
nx = ocx + (ev.xmotion.x - x1);
|
||||||
ny = ocy + (ev.xmotion.y - y1);
|
ny = ocy + (ev.xmotion.y - y1);
|
||||||
Monitor *m = &monitors[monitorat()];
|
|
||||||
if(abs(m->wax - nx) < SNAP)
|
if(abs(m->wax - nx) < SNAP)
|
||||||
nx = m->wax;
|
nx = m->wax;
|
||||||
else if(abs((m->wax + m->waw) - (nx + c->w + 2 * c->border)) < SNAP)
|
else if(abs((m->wax + m->waw) - (nx + c->w + 2 * c->border)) < SNAP)
|
||||||
|
@ -1197,11 +1197,10 @@ movemouse(Client *c) {
|
||||||
ny = m->way;
|
ny = m->way;
|
||||||
else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
|
else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
|
||||||
ny = m->way + m->wah - c->h - 2 * c->border;
|
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);
|
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);
|
resize(c, nx, ny, c->w, c->h, False);
|
||||||
memcpy(c->tags, monitors[monitorat()].seltags, sizeof initags);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1335,10 +1334,12 @@ void
|
||||||
resizemouse(Client *c) {
|
resizemouse(Client *c) {
|
||||||
int ocx, ocy;
|
int ocx, ocy;
|
||||||
int nw, nh;
|
int nw, nh;
|
||||||
|
Monitor *m;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
ocx = c->x;
|
ocx = c->x;
|
||||||
ocy = c->y;
|
ocy = c->y;
|
||||||
|
m = &monitors[c->monitor];
|
||||||
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, cursor[CurResize], CurrentTime) != GrabSuccess)
|
None, cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
|
@ -1363,9 +1364,9 @@ resizemouse(Client *c) {
|
||||||
nw = 1;
|
nw = 1;
|
||||||
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
if((nh = ev.xmotion.y - ocy - 2 * c->border + 1) <= 0)
|
||||||
nh = 1;
|
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);
|
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);
|
resize(c, c->x, c->y, nw, nh, True);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1600,8 +1601,6 @@ setup(void) {
|
||||||
/* init geometry */
|
/* init geometry */
|
||||||
m = &monitors[i];
|
m = &monitors[i];
|
||||||
|
|
||||||
m->monitor = i;
|
|
||||||
|
|
||||||
if (mcount != 1 && isxinerama) {
|
if (mcount != 1 && isxinerama) {
|
||||||
m->sx = info[i].x_org;
|
m->sx = info[i].x_org;
|
||||||
m->sy = info[i].y_org;
|
m->sy = info[i].y_org;
|
||||||
|
|
Loading…
Reference in a new issue