moveresize: Refactor some conditions for readability
This commit is contained in:
parent
a5228ad9e0
commit
8090324299
|
@ -476,6 +476,7 @@ _MoveResizeMoveHandleMotion(void)
|
||||||
int ndx, ndy;
|
int ndx, ndy;
|
||||||
char jumpx, jumpy;
|
char jumpx, jumpy;
|
||||||
int min_dx, max_dx, min_dy, max_dy;
|
int min_dx, max_dx, min_dy, max_dy;
|
||||||
|
int at_screen_edge;
|
||||||
|
|
||||||
ewin = Mode_mr.ewin;
|
ewin = Mode_mr.ewin;
|
||||||
if (!ewin)
|
if (!ewin)
|
||||||
|
@ -580,34 +581,36 @@ _MoveResizeMoveHandleMotion(void)
|
||||||
dd = ewin1->req_x - ewin1->shape_x;
|
dd = ewin1->req_x - ewin1->shape_x;
|
||||||
if (dd < 0)
|
if (dd < 0)
|
||||||
dd = -dd;
|
dd = -dd;
|
||||||
if ((ndx != dx) &&
|
if (ndx != dx)
|
||||||
(((ewin1->shape_x == 0) &&
|
|
||||||
(dd > Conf.snap.screen_snap_dist)) ||
|
|
||||||
((ewin1->shape_x == (WinGetW(VROOT) - EoGetW(ewin1))) &&
|
|
||||||
(dd > Conf.snap.screen_snap_dist)) ||
|
|
||||||
((ewin1->shape_x != 0) &&
|
|
||||||
(ewin1->shape_x != (WinGetW(VROOT) - EoGetW(ewin1)) &&
|
|
||||||
(dd > Conf.snap.edge_snap_dist)))))
|
|
||||||
{
|
{
|
||||||
jumpx = 1;
|
at_screen_edge =
|
||||||
ndx = ewin1->req_x - ewin1->shape_x + dx;
|
ewin1->shape_x == 0 ||
|
||||||
|
ewin1->shape_x + EoGetW(ewin1) == WinGetW(VROOT);
|
||||||
|
|
||||||
|
if ((at_screen_edge && dd > Conf.snap.screen_snap_dist) ||
|
||||||
|
(!at_screen_edge && dd > Conf.snap.edge_snap_dist))
|
||||||
|
{
|
||||||
|
jumpx = 1;
|
||||||
|
ndx = ewin1->req_x - ewin1->shape_x + dx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jump out of snap vertically */
|
/* jump out of snap vertically */
|
||||||
dd = ewin1->req_y - ewin1->shape_y;
|
dd = ewin1->req_y - ewin1->shape_y;
|
||||||
if (dd < 0)
|
if (dd < 0)
|
||||||
dd = -dd;
|
dd = -dd;
|
||||||
if ((ndy != dy) &&
|
if (ndy != dy)
|
||||||
(((ewin1->shape_y == 0) &&
|
|
||||||
(dd > Conf.snap.screen_snap_dist)) ||
|
|
||||||
((ewin1->shape_y == (WinGetH(VROOT) - EoGetH(ewin1))) &&
|
|
||||||
(dd > Conf.snap.screen_snap_dist)) ||
|
|
||||||
((ewin1->shape_y != 0) &&
|
|
||||||
(ewin1->shape_y != (WinGetH(VROOT) - EoGetH(ewin1)) &&
|
|
||||||
(dd > Conf.snap.edge_snap_dist)))))
|
|
||||||
{
|
{
|
||||||
jumpy = 1;
|
at_screen_edge =
|
||||||
ndy = ewin1->req_y - ewin1->shape_y + dy;
|
ewin1->shape_y == 0 ||
|
||||||
|
ewin1->shape_y + EoGetH(ewin1) == WinGetH(VROOT);
|
||||||
|
|
||||||
|
if ((at_screen_edge && dd > Conf.snap.screen_snap_dist) ||
|
||||||
|
(!at_screen_edge && dd > Conf.snap.edge_snap_dist))
|
||||||
|
{
|
||||||
|
jumpy = 1;
|
||||||
|
ndy = ewin1->req_y - ewin1->shape_y + dy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue