Fix floating window movement (finally, I hope).
SVN revision: 10276
This commit is contained in:
parent
33d9c8fb28
commit
18082e70c3
4
src/E.h
4
src/E.h
|
@ -892,7 +892,9 @@ WinClient;
|
|||
struct _ewin
|
||||
{
|
||||
Window win;
|
||||
int x, y, w, h, reqx, reqy;
|
||||
int x, y, w, h;
|
||||
int shape_x, shape_y;
|
||||
int req_x, req_y;
|
||||
int lx, ly, lw, lh;
|
||||
char type;
|
||||
char state;
|
||||
|
|
155
src/arrange.c
155
src/arrange.c
|
@ -597,7 +597,8 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
|
|||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
ScreenGetGeometry(ewin->x, ewin->y, &left_bound, &top_bound, &w, &h);
|
||||
ScreenGetGeometry(ewin->shape_x, ewin->shape_y, &left_bound, &top_bound, &w,
|
||||
&h);
|
||||
right_bound = left_bound + w;
|
||||
bottom_bound = top_bound + h;
|
||||
screen_snap_dist = Mode.constrained ? (w + h) : Conf.snap.screen_snap_dist;
|
||||
|
@ -617,150 +618,150 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
|
|||
}
|
||||
Efree(gwins);
|
||||
}
|
||||
|
||||
odx = dx;
|
||||
ody = dy;
|
||||
if (dx < 0)
|
||||
{
|
||||
if (IN_BELOW(ewin->x + dx, left_bound, screen_snap_dist)
|
||||
&& (ewin->x >= left_bound))
|
||||
if (IN_BELOW(ewin->shape_x + dx, left_bound, screen_snap_dist)
|
||||
&& (ewin->shape_x >= left_bound))
|
||||
{
|
||||
dx = left_bound - ewin->x;
|
||||
dx = left_bound - ewin->shape_x;
|
||||
}
|
||||
else if (lst)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (lst[i])
|
||||
if (lst[i] == NULL)
|
||||
continue;
|
||||
|
||||
if (((ewin->desktop == lst[i]->desktop) ||
|
||||
(lst[i]->sticky)) && (!(lst[i]->floating)) &&
|
||||
(!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
|
||||
{
|
||||
if (((ewin->desktop == lst[i]->desktop)
|
||||
|| (lst[i]->sticky)) && (!(lst[i]->floating))
|
||||
&& (!(lst[i]->iconified))
|
||||
&& (!(lst[i]->ignorearrange)))
|
||||
if (IN_BELOW
|
||||
(ewin->shape_x + dx, lst[i]->x + lst[i]->w - 1,
|
||||
Conf.snap.edge_snap_dist)
|
||||
&& SPANS_COMMON(ewin->shape_y, ewin->h, lst[i]->y,
|
||||
lst[i]->h)
|
||||
&& (ewin->shape_x >= (lst[i]->x + lst[i]->w)))
|
||||
{
|
||||
if (IN_BELOW
|
||||
(ewin->x + dx, lst[i]->x + lst[i]->w - 1,
|
||||
Conf.snap.edge_snap_dist)
|
||||
&& SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
|
||||
lst[i]->h)
|
||||
&& (ewin->x >= (lst[i]->x + lst[i]->w)))
|
||||
{
|
||||
dx = (lst[i]->x + lst[i]->w) - ewin->x;
|
||||
break;
|
||||
}
|
||||
dx = (lst[i]->x + lst[i]->w) - ewin->shape_x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ewin->reqx - ewin->x) > 0)
|
||||
if ((ewin->req_x - ewin->shape_x) > 0)
|
||||
dx = 0;
|
||||
}
|
||||
else if (dx > 0)
|
||||
{
|
||||
if (IN_ABOVE(ewin->x + ewin->w + dx, right_bound, screen_snap_dist)
|
||||
&& ((ewin->x + ewin->w) <= right_bound))
|
||||
if (IN_ABOVE
|
||||
(ewin->shape_x + ewin->w + dx, right_bound, screen_snap_dist)
|
||||
&& ((ewin->shape_x + ewin->w) <= right_bound))
|
||||
{
|
||||
dx = right_bound - (ewin->x + ewin->w);
|
||||
dx = right_bound - (ewin->shape_x + ewin->w);
|
||||
}
|
||||
else if (lst)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (lst[i])
|
||||
if (lst[i] == NULL)
|
||||
continue;
|
||||
|
||||
if (((ewin->desktop == lst[i]->desktop) ||
|
||||
(lst[i]->sticky)) && (!(lst[i]->floating)) &&
|
||||
(!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
|
||||
{
|
||||
if (((ewin->desktop == lst[i]->desktop)
|
||||
|| (lst[i]->sticky)) && (!(lst[i]->floating))
|
||||
&& (!(lst[i]->iconified))
|
||||
&& (!(lst[i]->ignorearrange)))
|
||||
if (IN_ABOVE(ewin->shape_x + ewin->w + dx - 1, lst[i]->x,
|
||||
Conf.snap.edge_snap_dist) &&
|
||||
SPANS_COMMON(ewin->shape_y, ewin->h, lst[i]->y,
|
||||
lst[i]->h) &&
|
||||
((ewin->shape_x + ewin->w) <= lst[i]->x))
|
||||
{
|
||||
if (IN_ABOVE
|
||||
(ewin->x + ewin->w + dx - 1, lst[i]->x,
|
||||
Conf.snap.edge_snap_dist)
|
||||
&& SPANS_COMMON(ewin->y, ewin->h, lst[i]->y,
|
||||
lst[i]->h)
|
||||
&& ((ewin->x + ewin->w) <= lst[i]->x))
|
||||
{
|
||||
dx = lst[i]->x - (ewin->x + ewin->w);
|
||||
break;
|
||||
}
|
||||
dx = lst[i]->x - (ewin->shape_x + ewin->w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ewin->reqx - ewin->x) < 0)
|
||||
if ((ewin->req_x - ewin->shape_x) < 0)
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
if (dy < 0)
|
||||
{
|
||||
if (IN_BELOW(ewin->y + dy, top_bound, screen_snap_dist)
|
||||
&& (ewin->y >= top_bound))
|
||||
if (IN_BELOW(ewin->shape_y + dy, top_bound, screen_snap_dist)
|
||||
&& (ewin->shape_y >= top_bound))
|
||||
{
|
||||
dy = top_bound - ewin->y;
|
||||
dy = top_bound - ewin->shape_y;
|
||||
}
|
||||
else if (lst)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (lst[i])
|
||||
if (lst[i] == NULL)
|
||||
continue;
|
||||
|
||||
if (((ewin->desktop == lst[i]->desktop) ||
|
||||
(lst[i]->sticky)) && (!(lst[i]->floating)) &&
|
||||
(!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
|
||||
{
|
||||
if (((ewin->desktop == lst[i]->desktop)
|
||||
|| (lst[i]->sticky)) && (!(lst[i]->floating))
|
||||
&& (!(lst[i]->iconified))
|
||||
&& (!(lst[i]->ignorearrange)))
|
||||
if (IN_BELOW
|
||||
(ewin->shape_y + dy, lst[i]->y + lst[i]->h - 1,
|
||||
Conf.snap.edge_snap_dist)
|
||||
&& SPANS_COMMON(ewin->shape_x, ewin->w, lst[i]->x,
|
||||
lst[i]->w)
|
||||
&& (ewin->shape_y >= (lst[i]->y + lst[i]->h)))
|
||||
{
|
||||
if (IN_BELOW
|
||||
(ewin->y + dy, lst[i]->y + lst[i]->h - 1,
|
||||
Conf.snap.edge_snap_dist)
|
||||
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
||||
lst[i]->w)
|
||||
&& (ewin->y >= (lst[i]->y + lst[i]->h)))
|
||||
{
|
||||
dy = (lst[i]->y + lst[i]->h) - ewin->y;
|
||||
break;
|
||||
}
|
||||
dy = (lst[i]->y + lst[i]->h) - ewin->shape_y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ewin->reqy - ewin->y) > 0)
|
||||
if ((ewin->req_y - ewin->shape_y) > 0)
|
||||
dy = 0;
|
||||
}
|
||||
else if (dy > 0)
|
||||
{
|
||||
if (IN_ABOVE(ewin->y + ewin->h + dy, bottom_bound, screen_snap_dist)
|
||||
&& ((ewin->y + ewin->h) <= bottom_bound))
|
||||
if (IN_ABOVE
|
||||
(ewin->shape_y + ewin->h + dy, bottom_bound, screen_snap_dist)
|
||||
&& ((ewin->shape_y + ewin->h) <= bottom_bound))
|
||||
{
|
||||
dy = bottom_bound - (ewin->y + ewin->h);
|
||||
dy = bottom_bound - (ewin->shape_y + ewin->h);
|
||||
}
|
||||
else if (lst)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (lst[i])
|
||||
if (lst[i] == NULL)
|
||||
continue;
|
||||
|
||||
if (((ewin->desktop == lst[i]->desktop) ||
|
||||
(lst[i]->sticky)) && (!(lst[i]->floating)) &&
|
||||
(!(lst[i]->iconified)) && (!(lst[i]->ignorearrange)))
|
||||
{
|
||||
if (((ewin->desktop == lst[i]->desktop)
|
||||
|| (lst[i]->sticky)) && (!(lst[i]->floating))
|
||||
&& (!(lst[i]->iconified))
|
||||
&& (!(lst[i]->ignorearrange)))
|
||||
if (IN_ABOVE(ewin->shape_y + ewin->h + dy - 1, lst[i]->y,
|
||||
Conf.snap.edge_snap_dist) &&
|
||||
SPANS_COMMON(ewin->shape_x, ewin->w, lst[i]->x,
|
||||
lst[i]->w) &&
|
||||
((ewin->shape_y + ewin->h) <= lst[i]->y))
|
||||
{
|
||||
if (IN_ABOVE
|
||||
(ewin->y + ewin->h + dy - 1, lst[i]->y,
|
||||
Conf.snap.edge_snap_dist)
|
||||
&& SPANS_COMMON(ewin->x, ewin->w, lst[i]->x,
|
||||
lst[i]->w)
|
||||
&& ((ewin->y + ewin->h) <= lst[i]->y))
|
||||
{
|
||||
dy = lst[i]->y - (ewin->y + ewin->h);
|
||||
break;
|
||||
}
|
||||
dy = lst[i]->y - (ewin->shape_y + ewin->h);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ewin->reqy - ewin->y) < 0)
|
||||
if ((ewin->req_y - ewin->shape_y) < 0)
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
if (lst)
|
||||
Efree(lst);
|
||||
|
||||
if ((odx != dx) || (ody != dy))
|
||||
{
|
||||
if (!last_res)
|
||||
|
|
|
@ -1233,8 +1233,6 @@ EwinCreate(Window win)
|
|||
ewin->y = -1;
|
||||
ewin->w = -1;
|
||||
ewin->h = -1;
|
||||
ewin->reqx = -1;
|
||||
ewin->reqy = -1;
|
||||
ewin->lx = -1;
|
||||
ewin->ly = -1;
|
||||
ewin->lw = -1;
|
||||
|
@ -1466,7 +1464,7 @@ EwinEventUnmap(EWin * ewin)
|
|||
|
||||
if (Mode.doingslide)
|
||||
{
|
||||
DrawEwinShape(ewin, Conf.slidemode, ewin->x, ewin->y,
|
||||
DrawEwinShape(ewin, Conf.slidemode, ewin->shape_x, ewin->shape_y,
|
||||
ewin->client.w, ewin->client.h, 2);
|
||||
Mode.doingslide = 0;
|
||||
}
|
||||
|
@ -1773,8 +1771,6 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|||
move = 1;
|
||||
ewin->x = x;
|
||||
ewin->y = y;
|
||||
ewin->reqx = x;
|
||||
ewin->reqy = y;
|
||||
}
|
||||
|
||||
if (flags & MR_FLAGS_RESIZE)
|
||||
|
@ -1826,7 +1822,11 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
|
|||
}
|
||||
|
||||
if ((Mode.mode == MODE_NONE) /* && (move || resize) */ )
|
||||
EwinUpdateAfterMoveResize(ewin, resize);
|
||||
{
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
EwinUpdateAfterMoveResize(ewin, resize);
|
||||
}
|
||||
|
||||
call_depth--;
|
||||
EDBUG_RETURN_;
|
||||
|
@ -1900,8 +1900,6 @@ FloatEwinAt(EWin * ewin, int x, int y)
|
|||
dy = y - ewin->y;
|
||||
ewin->x = x;
|
||||
ewin->y = y;
|
||||
ewin->reqx = x;
|
||||
ewin->reqy = y;
|
||||
ConformEwinToDesktop(ewin);
|
||||
if (ewin->has_transients)
|
||||
{
|
||||
|
@ -2396,7 +2394,6 @@ InstantShadeEwin(EWin * ewin, int force)
|
|||
ewin->shaded = 2;
|
||||
ewin->w = b;
|
||||
ewin->x = d;
|
||||
ewin->reqx = d;
|
||||
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
||||
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
||||
CalcEwinSizes(ewin);
|
||||
|
@ -2423,7 +2420,6 @@ InstantShadeEwin(EWin * ewin, int force)
|
|||
ewin->shaded = 2;
|
||||
ewin->h = b;
|
||||
ewin->y = d;
|
||||
ewin->reqy = d;
|
||||
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
||||
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
||||
CalcEwinSizes(ewin);
|
||||
|
@ -2479,7 +2475,6 @@ InstantUnShadeEwin(EWin * ewin)
|
|||
ewin->shaded = 0;
|
||||
ewin->w = b;
|
||||
ewin->x = d;
|
||||
ewin->reqx = d;
|
||||
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
||||
XSync(disp, False);
|
||||
break;
|
||||
|
@ -2503,7 +2498,6 @@ InstantUnShadeEwin(EWin * ewin)
|
|||
ewin->shaded = 0;
|
||||
ewin->h = b;
|
||||
ewin->y = d;
|
||||
ewin->reqy = d;
|
||||
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
||||
XSync(disp, False);
|
||||
break;
|
||||
|
@ -2616,7 +2610,6 @@ ShadeEwin(EWin * ewin)
|
|||
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
||||
ewin->w = i;
|
||||
ewin->x = j;
|
||||
ewin->reqx = j;
|
||||
if (ewin->w < 1)
|
||||
ewin->w = 1;
|
||||
ww = ewin->w - ewin->border->border.left -
|
||||
|
@ -2651,7 +2644,6 @@ ShadeEwin(EWin * ewin)
|
|||
ewin->shaded = 2;
|
||||
ewin->w = b;
|
||||
ewin->x = d;
|
||||
ewin->reqx = d;
|
||||
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
||||
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
||||
CalcEwinSizes(ewin);
|
||||
|
@ -2725,7 +2717,6 @@ ShadeEwin(EWin * ewin)
|
|||
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
||||
ewin->h = i;
|
||||
ewin->y = j;
|
||||
ewin->reqy = j;
|
||||
if (ewin->h < 1)
|
||||
ewin->h = 1;
|
||||
hh = ewin->h - ewin->border->border.top -
|
||||
|
@ -2760,7 +2751,6 @@ ShadeEwin(EWin * ewin)
|
|||
ewin->shaded = 2;
|
||||
ewin->h = b;
|
||||
ewin->y = d;
|
||||
ewin->reqy = d;
|
||||
EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
|
||||
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
|
||||
CalcEwinSizes(ewin);
|
||||
|
@ -2887,7 +2877,6 @@ UnShadeEwin(EWin * ewin)
|
|||
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
||||
ewin->w = i;
|
||||
ewin->x = j;
|
||||
ewin->reqx = j;
|
||||
EMoveResizeWindow(disp, ewin->win_container,
|
||||
ewin->border->border.left,
|
||||
ewin->border->border.top,
|
||||
|
@ -2916,7 +2905,6 @@ UnShadeEwin(EWin * ewin)
|
|||
}
|
||||
ewin->w = b;
|
||||
ewin->x = d;
|
||||
ewin->reqx = d;
|
||||
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
||||
XSync(disp, False);
|
||||
break;
|
||||
|
@ -2999,7 +2987,6 @@ UnShadeEwin(EWin * ewin)
|
|||
j = ((c * (1024 - k)) + (d * k)) >> 10;
|
||||
ewin->h = i;
|
||||
ewin->y = j;
|
||||
ewin->reqy = j;
|
||||
EMoveResizeWindow(disp, ewin->win_container,
|
||||
ewin->border->border.left,
|
||||
ewin->border->border.top, ewin->client.w,
|
||||
|
@ -3028,7 +3015,6 @@ UnShadeEwin(EWin * ewin)
|
|||
}
|
||||
ewin->h = b;
|
||||
ewin->y = d;
|
||||
ewin->reqy = d;
|
||||
MoveResizeEwin(ewin, ewin->x, ewin->y, ewin->client.w, ewin->client.h);
|
||||
XSync(disp, False);
|
||||
break;
|
||||
|
|
|
@ -47,8 +47,8 @@ SetCoords(EWin * ewin)
|
|||
if ((!ic) || (!tc))
|
||||
return;
|
||||
|
||||
x = ewin->x;
|
||||
y = ewin->y;
|
||||
x = ewin->shape_x;
|
||||
y = ewin->shape_y;
|
||||
w = (ewin->client.w - ewin->client.base_w) / ewin->client.w_inc;
|
||||
h = (ewin->client.h - ewin->client.base_h) / ewin->client.h_inc;
|
||||
|
||||
|
@ -79,9 +79,9 @@ SetCoords(EWin * ewin)
|
|||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
cx = ewin->x + ((ewin->w - cw) / 2) +
|
||||
cx = x + ((ewin->w - cw) / 2) +
|
||||
desks.desk[ewin->desktop].x;
|
||||
cy = ewin->y + ((ewin->h - ch) / 2) +
|
||||
cy = y + ((ewin->h - ch) / 2) +
|
||||
desks.desk[ewin->desktop].y;
|
||||
break;
|
||||
}
|
||||
|
|
32
src/draw.c
32
src/draw.c
|
@ -1317,10 +1317,10 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
ewin->client.w = w;
|
||||
ewin->client.h = h;
|
||||
ICCCM_MatchSize(ewin);
|
||||
i = (x - ewin->x) / ewin->client.w_inc;
|
||||
j = (y - ewin->y) / ewin->client.h_inc;
|
||||
x = ewin->x + (i * ewin->client.w_inc);
|
||||
y = ewin->y + (j * ewin->client.h_inc);
|
||||
i = (x - ewin->shape_x) / ewin->client.w_inc;
|
||||
j = (y - ewin->shape_y) / ewin->client.h_inc;
|
||||
x = ewin->shape_x + (i * ewin->client.w_inc);
|
||||
y = ewin->shape_y + (j * ewin->client.h_inc);
|
||||
ewin->client.w = w1;
|
||||
ewin->client.h = h1;
|
||||
}
|
||||
|
@ -1358,6 +1358,8 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
{
|
||||
case 0:
|
||||
MoveResizeEwin(ewin, x, y, w, h);
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
if (Mode.mode != MODE_NONE)
|
||||
SetCoords(ewin);
|
||||
break;
|
||||
|
@ -1375,16 +1377,12 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
if (!b3)
|
||||
b3 = XCreateBitmapFromData(disp, VRoot.win, gray3_bits, gray3_width,
|
||||
gray3_height);
|
||||
x1 = ewin->x + desks.desk[ewin->desktop].x;
|
||||
y1 = ewin->y + desks.desk[ewin->desktop].y;
|
||||
x1 = ewin->shape_x;
|
||||
y1 = ewin->shape_y;
|
||||
w1 = ewin->w - (ewin->border->border.left + ewin->border->border.right);
|
||||
h1 = ewin->h - (ewin->border->border.top + ewin->border->border.bottom);
|
||||
ewin->x = x;
|
||||
ewin->y = y;
|
||||
ewin->reqx = x;
|
||||
ewin->reqy = y;
|
||||
x = ewin->x + desks.desk[ewin->desktop].x;
|
||||
y = ewin->y + desks.desk[ewin->desktop].y;
|
||||
ewin->shape_x = x;
|
||||
ewin->shape_y = y;
|
||||
if ((w != ewin->client.w) || (h != ewin->client.h))
|
||||
{
|
||||
ewin->client.w = w;
|
||||
|
@ -1732,9 +1730,9 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
|| (ewin->groups && !check_move))
|
||||
{
|
||||
if (ewin->shaded)
|
||||
MoveEwin(ewin, ewin->x, ewin->y);
|
||||
MoveEwin(ewin, ewin->shape_x, ewin->shape_y);
|
||||
else
|
||||
MoveResizeEwin(ewin, ewin->x, ewin->y, pw, ph);
|
||||
MoveResizeEwin(ewin, ewin->shape_x, ewin->shape_y, pw, ph);
|
||||
}
|
||||
XFreeGC(disp, gc);
|
||||
gc = 0;
|
||||
|
@ -1744,6 +1742,12 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
|
|||
break;
|
||||
}
|
||||
|
||||
if (firstlast == 0 || firstlast == 2 || firstlast == 4)
|
||||
{
|
||||
ewin->req_x = ewin->shape_x;
|
||||
ewin->req_y = ewin->shape_y;
|
||||
}
|
||||
|
||||
done:
|
||||
Mode.queue_up = pq;
|
||||
EDBUG_RETURN_;
|
||||
|
|
10
src/icccm.c
10
src/icccm.c
|
@ -395,12 +395,10 @@ ICCCM_Adopt(EWin * ewin)
|
|||
(unsigned char *)c, 2);
|
||||
ewin->x = ewin->client.x;
|
||||
ewin->y = ewin->client.y;
|
||||
ewin->reqx = ewin->client.x;
|
||||
ewin->reqy = ewin->client.y;
|
||||
ewin->w =
|
||||
ewin->client.w + ewin->border->border.left + ewin->border->border.right;
|
||||
ewin->h =
|
||||
ewin->client.h + ewin->border->border.top + ewin->border->border.bottom;
|
||||
ewin->w = ewin->client.w +
|
||||
ewin->border->border.left + ewin->border->border.right;
|
||||
ewin->h = ewin->client.h +
|
||||
ewin->border->border.top + ewin->border->border.bottom;
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
|
222
src/moveresize.c
222
src/moveresize.c
|
@ -128,11 +128,9 @@ ActionMoveEnd(EWin * ewin)
|
|||
{
|
||||
wasresize = 1;
|
||||
for (i = 0; i < num; i++)
|
||||
DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->x, gwins[i]->y,
|
||||
gwins[i]->client.w, gwins[i]->client.h,
|
||||
Mode.firstlast);
|
||||
for (i = 0; i < num; i++)
|
||||
MoveEwin(gwins[i], gwins[i]->x, gwins[i]->y);
|
||||
DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->shape_x,
|
||||
gwins[i]->shape_y, gwins[i]->client.w,
|
||||
gwins[i]->client.h, Mode.firstlast);
|
||||
}
|
||||
Mode.mode = MODE_NONE;
|
||||
|
||||
|
@ -142,16 +140,19 @@ ActionMoveEnd(EWin * ewin)
|
|||
{
|
||||
if (gwins[i]->floating)
|
||||
MoveEwinToDesktopAt(gwins[i], d,
|
||||
gwins[i]->x - (desks.desk[d].x -
|
||||
desks.
|
||||
desk[gwins[i]->desktop].x),
|
||||
gwins[i]->y - (desks.desk[d].y -
|
||||
desks.
|
||||
desk[gwins[i]->desktop].y));
|
||||
gwins[i]->shape_x - (desks.desk[d].x -
|
||||
desks.desk[gwins[i]->
|
||||
desktop].x),
|
||||
gwins[i]->shape_y - (desks.desk[d].y -
|
||||
desks.desk[gwins[i]->
|
||||
desktop].
|
||||
y));
|
||||
else
|
||||
MoveEwinToDesktopAt(gwins[i], d, gwins[i]->x, gwins[i]->y);
|
||||
MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x,
|
||||
gwins[i]->shape_y);
|
||||
gwins[i]->floating = 0;
|
||||
}
|
||||
|
||||
if ((Conf.movemode > 0) && (gwins[i]->has_transients))
|
||||
{
|
||||
EWin **lst;
|
||||
|
@ -201,8 +202,6 @@ ActionMoveEnd(EWin * ewin)
|
|||
EDBUG_RETURN(0);
|
||||
}
|
||||
|
||||
static int area_x, area_y;
|
||||
|
||||
int
|
||||
ActionMoveSuspend(void)
|
||||
{
|
||||
|
@ -213,8 +212,6 @@ ActionMoveSuspend(void)
|
|||
if (!ewin)
|
||||
return 0;
|
||||
|
||||
GetCurrentArea(&area_x, &area_y);
|
||||
|
||||
if (Mode.mode == MODE_MOVE_PENDING)
|
||||
return 0;
|
||||
|
||||
|
@ -225,7 +222,7 @@ ActionMoveSuspend(void)
|
|||
for (i = 0; i < num; i++)
|
||||
{
|
||||
ewin = lst[i];
|
||||
DrawEwinShape(ewin, Conf.movemode, ewin->x, ewin->y,
|
||||
DrawEwinShape(ewin, Conf.movemode, ewin->shape_x, ewin->shape_y,
|
||||
ewin->client.w, ewin->client.h, 3);
|
||||
}
|
||||
if (lst)
|
||||
|
@ -240,7 +237,7 @@ ActionMoveResume(void)
|
|||
{
|
||||
EWin *ewin, **lst;
|
||||
int i, num;
|
||||
int x, y, ax, ay, dx, dy, fl;
|
||||
int x, y, ax, ay, fl;
|
||||
|
||||
ewin = mode_moveresize_ewin;
|
||||
if (!ewin)
|
||||
|
@ -264,32 +261,12 @@ ActionMoveResume(void)
|
|||
if (!ewin->floating)
|
||||
continue;
|
||||
|
||||
x = ewin->x;
|
||||
y = ewin->y;
|
||||
x = ewin->shape_x;
|
||||
y = ewin->shape_y;
|
||||
if (Mode.flipp)
|
||||
{
|
||||
dx = Mode.x - Mode.px;
|
||||
dy = Mode.y - Mode.py;
|
||||
if (Conf.movemode == 0)
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += dx + (ax - area_x) * VRoot.w;
|
||||
y += dy + (ay - area_y) * VRoot.h;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = (ax - area_x) * VRoot.w;
|
||||
dy = (ay - area_y) * VRoot.h;
|
||||
if (Conf.movemode != 0)
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
x += Mode.x - Mode.px;
|
||||
y += Mode.y - Mode.py;
|
||||
}
|
||||
DrawEwinShape(ewin, Conf.movemode, x, y,
|
||||
ewin->client.w, ewin->client.h, fl);
|
||||
|
@ -395,8 +372,8 @@ ActionResizeEnd(EWin * ewin)
|
|||
Mode.queue_up = DRAW_QUEUE_ENABLE;
|
||||
Mode.mode = MODE_NONE;
|
||||
Mode.firstlast = 2;
|
||||
DrawEwinShape(ewin, Conf.resizemode, ewin->x, ewin->y, ewin->client.w,
|
||||
ewin->client.h, Mode.firstlast);
|
||||
DrawEwinShape(ewin, Conf.resizemode, ewin->shape_x, ewin->shape_y,
|
||||
ewin->client.w, ewin->client.h, Mode.firstlast);
|
||||
for (i = 0; i < ewin->border->num_winparts; i++)
|
||||
ewin->bits[i].no_expose = 1;
|
||||
ICCCM_Configure(ewin);
|
||||
|
@ -419,13 +396,10 @@ ActionResizeEnd(EWin * ewin)
|
|||
void
|
||||
ActionMoveHandleMotion(void)
|
||||
{
|
||||
int dx, dy;
|
||||
EWin *ewin;
|
||||
|
||||
EWin **gwins;
|
||||
int i, j, num;
|
||||
int dx, dy, dd;
|
||||
EWin *ewin, **gwins, *ewin1;
|
||||
int i, num;
|
||||
int ndx, ndy;
|
||||
int prx, pry;
|
||||
int screen_snap_dist;
|
||||
char jumpx, jumpy;
|
||||
int min_dx, max_dx, min_dy, max_dy;
|
||||
|
@ -440,9 +414,11 @@ ActionMoveHandleMotion(void)
|
|||
if (Mode.mode == MODE_MOVE_PENDING)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->x,
|
||||
gwins[i]->y, gwins[i]->client.w,
|
||||
gwins[i]->client.h, 0);
|
||||
{
|
||||
ewin1 = gwins[i];
|
||||
DrawEwinShape(ewin1, Conf.movemode, ewin1->x,
|
||||
ewin1->y, ewin1->client.w, ewin1->client.h, 0);
|
||||
}
|
||||
Mode.mode = MODE_MOVE;
|
||||
}
|
||||
|
||||
|
@ -505,93 +481,103 @@ ActionMoveHandleMotion(void)
|
|||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
ewin1 = gwins[i];
|
||||
|
||||
/* jump out of snap horizontally */
|
||||
dd = ewin1->req_x - ewin1->shape_x;
|
||||
if (dd < 0)
|
||||
dd = -dd;
|
||||
if ((ndx != dx) &&
|
||||
(((gwins[i]->x == 0) &&
|
||||
(!(IN_RANGE(gwins[i]->reqx, gwins[i]->x, screen_snap_dist)))) ||
|
||||
((gwins[i]->x == (VRoot.w - gwins[i]->w)) &&
|
||||
(!(IN_RANGE(gwins[i]->reqx, gwins[i]->x, screen_snap_dist)))) ||
|
||||
((gwins[i]->x != 0) &&
|
||||
(gwins[i]->x != (VRoot.w - gwins[i]->w) &&
|
||||
(!(IN_RANGE(gwins[i]->reqx, gwins[i]->x,
|
||||
Conf.snap.edge_snap_dist)))))))
|
||||
(((ewin1->shape_x == 0) &&
|
||||
(dd > screen_snap_dist)) ||
|
||||
((ewin1->shape_x == (VRoot.w - ewin1->w)) &&
|
||||
(dd > screen_snap_dist)) ||
|
||||
((ewin1->shape_x != 0) &&
|
||||
(ewin1->shape_x != (VRoot.w - ewin1->w) &&
|
||||
(dd > Conf.snap.edge_snap_dist)))))
|
||||
{
|
||||
jumpx = 1;
|
||||
ndx = gwins[i]->reqx - gwins[i]->x + dx;
|
||||
ndx = ewin1->req_x - ewin1->shape_x + dx;
|
||||
}
|
||||
|
||||
/* jump out of snap vertically */
|
||||
dd = ewin1->req_y - ewin1->shape_y;
|
||||
if (dd < 0)
|
||||
dd = -dd;
|
||||
if ((ndy != dy) &&
|
||||
(((gwins[i]->y == 0) &&
|
||||
(!(IN_RANGE(gwins[i]->reqy, gwins[i]->y, screen_snap_dist)))) ||
|
||||
((gwins[i]->y == (VRoot.h - gwins[i]->h)) &&
|
||||
(!(IN_RANGE(gwins[i]->reqy, gwins[i]->y, screen_snap_dist)))) ||
|
||||
((gwins[i]->y != 0) &&
|
||||
(gwins[i]->y != (VRoot.h - gwins[i]->h) &&
|
||||
(!(IN_RANGE(gwins[i]->reqy, gwins[i]->y,
|
||||
Conf.snap.edge_snap_dist)))))))
|
||||
(((ewin1->shape_y == 0) &&
|
||||
(dd > screen_snap_dist)) ||
|
||||
((ewin1->shape_y == (VRoot.h - ewin1->h)) &&
|
||||
(dd > screen_snap_dist)) ||
|
||||
((ewin1->shape_y != 0) &&
|
||||
(ewin1->shape_y != (VRoot.h - ewin1->h) &&
|
||||
(dd > Conf.snap.edge_snap_dist)))))
|
||||
{
|
||||
jumpy = 1;
|
||||
ndy = gwins[i]->reqy - gwins[i]->y + dy;
|
||||
ndy = ewin1->req_y - ewin1->shape_y + dy;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
ewin1 = gwins[i];
|
||||
|
||||
/* if its opaque move mode check to see if we have to float */
|
||||
/* the window aboe all desktops (reparent to root) */
|
||||
if (Conf.movemode == 0)
|
||||
DetermineEwinFloat(gwins[i], ndx, ndy);
|
||||
DetermineEwinFloat(ewin1, ndx, ndy);
|
||||
|
||||
/* draw the new position of the window */
|
||||
prx = gwins[i]->reqx;
|
||||
pry = gwins[i]->reqy;
|
||||
DrawEwinShape(gwins[i], Conf.movemode, gwins[i]->x + ndx,
|
||||
gwins[i]->y + ndy, gwins[i]->client.w,
|
||||
gwins[i]->client.h, Mode.firstlast);
|
||||
/* if we didnt jump the winow after a resist at the edge */
|
||||
DrawEwinShape(ewin1, Conf.movemode, ewin1->shape_x + ndx,
|
||||
ewin1->shape_y + ndy, ewin1->client.w,
|
||||
ewin1->client.h, Mode.firstlast);
|
||||
|
||||
/* if we didnt jump the window after a resist at the edge */
|
||||
/* reset the requested x to be the prev. requested + delta */
|
||||
if (!(jumpx))
|
||||
gwins[i]->reqx = prx + dx;
|
||||
if (!(jumpy))
|
||||
gwins[i]->reqy = pry + dy;
|
||||
/* if we did jump set requested to current shape position */
|
||||
ewin1->req_x = (jumpx) ? ewin1->shape_x : ewin1->req_x + dx;
|
||||
ewin1->req_y = (jumpy) ? ewin1->shape_y : ewin1->req_y + dy;
|
||||
|
||||
/* swapping of group member locations: */
|
||||
if (Mode.swapmovemode && Conf.group_swapmove)
|
||||
{
|
||||
EWin **all_gwins;
|
||||
int all_gwins_num;
|
||||
EWin **all_gwins, *ewin2;
|
||||
int j, all_gwins_num;
|
||||
|
||||
all_gwins =
|
||||
ListWinGroupMembersForEwin(ewin, ACTION_NONE, 0,
|
||||
&all_gwins_num);
|
||||
all_gwins = ListWinGroupMembersForEwin(ewin, ACTION_NONE, 0,
|
||||
&all_gwins_num);
|
||||
|
||||
for (j = 0; j < all_gwins_num; j++)
|
||||
{
|
||||
if (gwins[i] == all_gwins[j])
|
||||
ewin2 = all_gwins[j];
|
||||
|
||||
if (ewin1 == ewin2)
|
||||
continue;
|
||||
|
||||
/* check for sufficient overlap and avoid flickering */
|
||||
if (((gwins[i]->x >= all_gwins[j]->x &&
|
||||
gwins[i]->x <= all_gwins[j]->x + all_gwins[j]->w / 2 &&
|
||||
Mode.x <= Mode.px) ||
|
||||
(gwins[i]->x <= all_gwins[j]->x &&
|
||||
gwins[i]->x + gwins[i]->w / 2 >= all_gwins[j]->x &&
|
||||
if (((ewin1->shape_x >= ewin2->shape_x &&
|
||||
ewin1->shape_x <= ewin2->shape_x +
|
||||
ewin2->w / 2 && Mode.x <= Mode.px) ||
|
||||
(ewin1->shape_x <= ewin2->shape_x &&
|
||||
ewin1->shape_x + ewin1->w / 2 >=
|
||||
ewin2->shape_x &&
|
||||
Mode.x >= Mode.px)) &&
|
||||
((gwins[i]->y >= all_gwins[j]->y &&
|
||||
gwins[i]->y <= all_gwins[j]->y + all_gwins[j]->h / 2 &&
|
||||
Mode.y <= Mode.py) ||
|
||||
(gwins[i]->y <= all_gwins[j]->y &&
|
||||
gwins[i]->y + gwins[i]->h / 2 >= all_gwins[j]->y &&
|
||||
Mode.y >= Mode.py)))
|
||||
((ewin1->shape_y >= ewin2->shape_y
|
||||
&& ewin1->shape_y <=
|
||||
ewin2->shape_y + ewin2->h / 2
|
||||
&& Mode.y <= Mode.py) || (ewin1->y <= ewin2->y
|
||||
&& ewin1->shape_y +
|
||||
ewin1->h / 2 >= ewin2->shape_y
|
||||
&& Mode.y >= Mode.py)))
|
||||
{
|
||||
int tmp_swapcoord_x;
|
||||
int tmp_swapcoord_y;
|
||||
|
||||
tmp_swapcoord_x = Mode.swapcoord_x;
|
||||
tmp_swapcoord_y = Mode.swapcoord_y;
|
||||
Mode.swapcoord_x = all_gwins[j]->x;
|
||||
Mode.swapcoord_y = all_gwins[j]->y;
|
||||
MoveEwin(all_gwins[j], tmp_swapcoord_x, tmp_swapcoord_y);
|
||||
Mode.swapcoord_x = ewin2->shape_x;
|
||||
Mode.swapcoord_y = ewin2->shape_y;
|
||||
MoveEwin(ewin2, tmp_swapcoord_x, tmp_swapcoord_y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -631,11 +617,11 @@ ActionResizeHandleMotion(void)
|
|||
w = ewin->client.w;
|
||||
h = ewin->client.h;
|
||||
if (pw == ewin->client.w)
|
||||
x = ewin->x;
|
||||
x = ewin->shape_x;
|
||||
else
|
||||
x = Mode.win_x + Mode.win_w - w;
|
||||
if (ph == ewin->client.h)
|
||||
y = ewin->y;
|
||||
y = ewin->shape_y;
|
||||
else
|
||||
y = Mode.win_y + Mode.win_h - h;
|
||||
ewin->client.w = pw;
|
||||
|
@ -646,13 +632,13 @@ ActionResizeHandleMotion(void)
|
|||
ph = ewin->client.h;
|
||||
w = Mode.win_w + (Mode.x - Mode.start_x);
|
||||
h = Mode.win_h - (Mode.y - Mode.start_y);
|
||||
x = ewin->x;
|
||||
x = ewin->shape_x;
|
||||
y = Mode.win_y + (Mode.y - Mode.start_y);
|
||||
ewin->client.h = h;
|
||||
ICCCM_MatchSize(ewin);
|
||||
h = ewin->client.h;
|
||||
if (ph == ewin->client.h)
|
||||
y = ewin->y;
|
||||
y = ewin->shape_y;
|
||||
else
|
||||
y = Mode.win_y + Mode.win_h - h;
|
||||
ewin->client.h = ph;
|
||||
|
@ -663,12 +649,12 @@ ActionResizeHandleMotion(void)
|
|||
w = Mode.win_w - (Mode.x - Mode.start_x);
|
||||
h = Mode.win_h + (Mode.y - Mode.start_y);
|
||||
x = Mode.win_x + (Mode.x - Mode.start_x);
|
||||
y = ewin->y;
|
||||
y = ewin->shape_y;
|
||||
ewin->client.w = w;
|
||||
ICCCM_MatchSize(ewin);
|
||||
w = ewin->client.w;
|
||||
if (pw == ewin->client.w)
|
||||
x = ewin->x;
|
||||
x = ewin->shape_x;
|
||||
else
|
||||
x = Mode.win_x + Mode.win_w - w;
|
||||
ewin->client.w = pw;
|
||||
|
@ -677,8 +663,8 @@ ActionResizeHandleMotion(void)
|
|||
case 3:
|
||||
w = Mode.win_w + (Mode.x - Mode.start_x);
|
||||
h = Mode.win_h + (Mode.y - Mode.start_y);
|
||||
x = ewin->x;
|
||||
y = ewin->y;
|
||||
x = ewin->shape_x;
|
||||
y = ewin->shape_y;
|
||||
DrawEwinShape(ewin, Conf.resizemode, x, y, w, h, Mode.firstlast);
|
||||
break;
|
||||
default:
|
||||
|
@ -694,12 +680,12 @@ ActionResizeHandleMotion(void)
|
|||
w = Mode.win_w - (Mode.x - Mode.start_x);
|
||||
h = ewin->client.h;
|
||||
x = Mode.win_x + (Mode.x - Mode.start_x);
|
||||
y = ewin->y;
|
||||
y = ewin->shape_y;
|
||||
ewin->client.w = w;
|
||||
ICCCM_MatchSize(ewin);
|
||||
w = ewin->client.w;
|
||||
if (pw == ewin->client.w)
|
||||
x = ewin->x;
|
||||
x = ewin->shape_x;
|
||||
else
|
||||
x = Mode.win_x + Mode.win_w - w;
|
||||
ewin->client.w = pw;
|
||||
|
@ -708,8 +694,8 @@ ActionResizeHandleMotion(void)
|
|||
case 1:
|
||||
w = Mode.win_w + (Mode.x - Mode.start_x);
|
||||
h = ewin->client.h;
|
||||
x = ewin->x;
|
||||
y = ewin->y;
|
||||
x = ewin->shape_x;
|
||||
y = ewin->shape_y;
|
||||
DrawEwinShape(ewin, Conf.resizemode, x, y, w, h, Mode.firstlast);
|
||||
break;
|
||||
default:
|
||||
|
@ -724,13 +710,13 @@ ActionResizeHandleMotion(void)
|
|||
ph = ewin->client.h;
|
||||
w = ewin->client.w;
|
||||
h = Mode.win_h - (Mode.y - Mode.start_y);
|
||||
x = ewin->x;
|
||||
x = ewin->shape_x;
|
||||
y = Mode.win_y + (Mode.y - Mode.start_y);
|
||||
ewin->client.h = h;
|
||||
ICCCM_MatchSize(ewin);
|
||||
h = ewin->client.h;
|
||||
if (ph == ewin->client.h)
|
||||
y = ewin->y;
|
||||
y = ewin->shape_y;
|
||||
else
|
||||
y = Mode.win_y + Mode.win_h - h;
|
||||
ewin->client.h = ph;
|
||||
|
@ -739,8 +725,8 @@ ActionResizeHandleMotion(void)
|
|||
case 1:
|
||||
w = ewin->client.w;
|
||||
h = Mode.win_h + (Mode.y - Mode.start_y);
|
||||
x = ewin->x;
|
||||
y = ewin->y;
|
||||
x = ewin->shape_x;
|
||||
y = ewin->shape_y;
|
||||
DrawEwinShape(ewin, Conf.resizemode, x, y, w, h, Mode.firstlast);
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue