Partial fix to broken floating windows (moving through edge flip, etc.).

SVN revision: 10250
This commit is contained in:
Kim Woelders 2004-05-15 22:42:21 +00:00
parent dec4fb84fa
commit 255090d8e7
7 changed files with 108 additions and 131 deletions

View File

@ -1271,7 +1271,6 @@ typedef struct
int mode;
char place;
char flipp;
int next_move_x_plus, next_move_y_plus;
Button *button;
int resize_detail;
int win_x, win_y, win_w, win_h;

View File

@ -243,7 +243,7 @@ void
SetCurrentArea(int ax, int ay)
{
EWin *const *lst, *ewin;
int i, num, a1, a2, x, y, dx, dy;
int i, num, dx, dy;
ToolTip *tt;
EDBUG(4, "SetCurrentArea");
@ -293,17 +293,12 @@ SetCurrentArea(int ax, int ay)
for (i = 0; i < num; i++)
{
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos || ewin->iconified)
if (ewin->sticky || ewin->fixedpos || ewin->iconified)
continue;
if (ewin->desktop != desks.current && !ewin->floating)
continue;
if ((ewin->floating) && (Conf.movemode > 0))
{
wnum++;
wl = Erealloc(wl, sizeof(Window) * wnum);
wl[wnum - 1] = ewin->win;
}
else if (!ewin->floating)
if (!(ewin->floating && Conf.movemode == 0))
{
wnum++;
wl = Erealloc(wl, sizeof(Window) * wnum);
@ -317,73 +312,21 @@ SetCurrentArea(int ax, int ay)
SlideWindowsBy(wl, wnum, -dx, -dy, Conf.desks.slidespeed);
Efree(wl);
}
/* move the windows to their final positions */
for (i = 0; i < num; i++)
{
char setflip = 0;
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos || ewin->floating || ewin->client.transient_for)
continue;
a1 = ewin->area_x;
a2 = ewin->area_y;
if (!Mode.flipp)
{
setflip = 1;
Mode.flipp = 1;
}
MoveEwin(ewin, ewin->x - dx, ewin->y - dy);
if (setflip)
Mode.flipp = 0;
ewin->area_x = a1;
ewin->area_y = a2;
HintsSetWindowArea(ewin);
}
}
else
/* move all windows to their final positions */
for (i = 0; i < num; i++)
{
/* move all windows across.... */
for (i = 0; i < num; i++)
{
ewin = lst[i];
if (ewin->desktop != desks.current || ewin->sticky ||
ewin->fixedpos)
continue;
ewin = lst[i];
if (ewin->sticky || ewin->fixedpos)
continue;
if (ewin->client.transient_for)
continue;
if (ewin->desktop != desks.current && !ewin->floating)
continue;
/* if we're moving this window and its not opaque move */
/* warp it across without remebering the xy stuff */
/* well work out the xy stuff later when the move finishes */
if (ewin->floating)
{
if (Conf.movemode > 0)
{
GetWinXY(ewin->win, &x, &y);
EMoveWindow(disp, ewin->win, x - dx, y - dy);
}
}
/* if we're not moving it... move it across */
else if (!ewin->client.transient_for)
{
char setflip = 0;
a1 = ewin->area_x;
a2 = ewin->area_y;
if (!Mode.flipp)
{
setflip = 1;
Mode.flipp = 1;
}
MoveEwin(ewin, ewin->x - dx, ewin->y - dy);
if (setflip)
Mode.flipp = 0;
ewin->area_x = a1;
ewin->area_y = a2;
HintsSetWindowArea(ewin);
}
}
if (!(ewin->floating && Conf.movemode == 0))
MoveEwin(ewin, ewin->x - dx, ewin->y - dy);
}
/* set hints up for it */

View File

@ -1800,21 +1800,21 @@ doMoveResizeEwin(EWin * ewin, int x, int y, int w, int h, int flags)
int i, num;
lst = ListTransientsFor(ewin->client.win, &num);
if (lst)
for (i = 0; i < num; i++)
{
for (i = 0; i < num; i++)
{
if (!((Mode.flipp) && (lst[i]->floating))
&& (lst[i]->client.mwm_decor_border
|| lst[i]->client.mwm_decor_resizeh
|| lst[i]->client.mwm_decor_title
|| lst[i]->client.mwm_decor_menu
|| lst[i]->client.mwm_decor_minimize
|| lst[i]->client.mwm_decor_maximize))
MoveEwin(lst[i], lst[i]->x + dx, lst[i]->y + dy);
}
Efree(lst);
#if 0 /* Why? */
if (!((Mode.flipp) && (lst[i]->floating))
&& (lst[i]->client.mwm_decor_border
|| lst[i]->client.mwm_decor_resizeh
|| lst[i]->client.mwm_decor_title
|| lst[i]->client.mwm_decor_menu
|| lst[i]->client.mwm_decor_minimize
|| lst[i]->client.mwm_decor_maximize))
#endif
MoveEwin(lst[i], lst[i]->x + dx, lst[i]->y + dy);
}
if (lst)
Efree(lst);
}
if ((Mode.mode == MODE_NONE) /* && (move || resize) */ )

View File

@ -1324,10 +1324,12 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
ewin->client.w = w1;
ewin->client.h = h1;
}
if ((md == 5)
&& ((Mode.mode == MODE_RESIZE) || (Mode.mode == MODE_RESIZE_H)
|| (Mode.mode == MODE_RESIZE_V) || (ewin->groups && check_move)))
md = 0;
if (md == 5)
{
if (VRoot.depth <= 8)
@ -1346,10 +1348,12 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
md = 0;
#endif
}
pw = w;
ph = h;
pq = Mode.queue_up;
Mode.queue_up = 0;
switch (md)
{
case 0:
@ -1569,10 +1573,9 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, char firstlast)
{
DO_DRAW_MODE_4(x1, y1, w1, h1);
}
if (firstlast < 2)
if ((Mode.mode != MODE_NONE)
&& (!ewin->groups || (ewin->groups && !check_move)))
SetCoords(ewin);
if ((Mode.mode != MODE_NONE)
&& (!ewin->groups || (ewin->groups && !check_move)))
SetCoords(ewin);
if (firstlast < 2)
{
DO_DRAW_MODE_4(x, y, w, h);

View File

@ -79,6 +79,8 @@ EdgeTimeout(int val, void *data)
if (ah == 1)
dy = 0;
XWarpPointer(disp, None, None, 0, 0, 0, 0, dx, dy);
Mode.px = Mode.x += dx;
Mode.py = Mode.y += dy;
data = NULL;
}

View File

@ -69,6 +69,9 @@ ActionMoveStart(EWin * ewin, const void *params, char constrained, int nogroup)
|| Mode.swapmovemode, &num);
for (i = 0; i < num; i++)
{
#if 0
gwins[i]->floating = 1; /* Reparent to root always */
#endif
FloatEwinAt(gwins[i], gwins[i]->x, gwins[i]->y);
#if 0 /* Will never get here */
if (Mode.mode == MODE_MOVE)
@ -198,32 +201,35 @@ ActionMoveEnd(EWin * ewin)
EDBUG_RETURN(0);
}
static int area_x, area_y;
int
ActionMoveSuspend(void)
{
EWin *ewin;
int x, y;
EWin *ewin, **lst;
int i, num;
ewin = mode_moveresize_ewin;
if (!ewin)
return 0;
if ((Mode.mode == MODE_MOVE) && (Conf.movemode > 0))
GetCurrentArea(&area_x, &area_y);
if (Mode.mode == MODE_MOVE_PENDING)
return 0;
/* If non opaque undraw our boxes */
if (Conf.movemode > 0)
{
x = ewin->x;
y = ewin->y;
ewin->x = -99999;
ewin->y = -99999;
ewin->reqx = -99999;
ewin->reqy = -99999;
DrawEwinShape(ewin, Conf.movemode, x, y,
ewin->client.w, ewin->client.h, /*3? */ 2);
}
else
{
FloatEwinAt(ewin,
ewin->x + desks.desk[ewin->desktop].x,
ewin->y + desks.desk[ewin->desktop].y);
lst = ListWinGroupMembersForEwin(ewin, ACTION_MOVE, Mode.nogroup, &num);
for (i = 0; i < num; i++)
{
ewin = lst[i];
DrawEwinShape(ewin, Conf.movemode, ewin->x, ewin->y,
ewin->client.w, ewin->client.h, 3);
}
if (lst)
Efree(lst);
}
return 0;
@ -232,24 +238,57 @@ ActionMoveSuspend(void)
int
ActionMoveResume(void)
{
EWin *ewin;
int x, y;
EWin *ewin, **lst;
int i, num;
int x, y, ax, ay, dx, dy, fl;
ewin = mode_moveresize_ewin;
if (!ewin)
return 0;
fl = (Conf.movemode == 5) ? 4 : 0;
if (Mode.mode == MODE_MOVE_PENDING)
Mode.mode = MODE_MOVE;
{
Mode.mode = MODE_MOVE;
fl = 0; /* This is the first time we draw it */
}
x = ewin->x;
y = ewin->y;
ewin->x = -99999;
ewin->y = -99999;
ewin->reqx = -99999;
ewin->reqy = -99999;
DrawEwinShape(ewin, Conf.movemode, x, y,
ewin->client.w, ewin->client.h, (Conf.movemode == 5) ? 4 : 0);
GetCurrentArea(&ax, &ay);
dx = (ax - area_x) * VRoot.w;
dy = (ay - area_y) * VRoot.h;
/* Redraw any windows that were in "move mode" */
lst = ListWinGroupMembersForEwin(ewin, ACTION_MOVE, Mode.nogroup, &num);
for (i = 0; i < num; i++)
{
ewin = lst[i];
if (!ewin->floating)
continue;
x = ewin->x;
y = ewin->y;
if (Mode.flipp)
{
if (Conf.movemode == 0)
{
x -= dx;
y -= dy;
}
}
else
{
if (Conf.movemode != 0)
{
x += dx;
y += dy;
}
}
DrawEwinShape(ewin, Conf.movemode, x, y,
ewin->client.w, ewin->client.h, fl);
}
if (lst)
Efree(lst);
return 0;
}
@ -400,16 +439,7 @@ ActionMoveHandleMotion(void)
dx = Mode.x - Mode.px;
dy = Mode.y - Mode.py;
if (Mode.next_move_x_plus != 0)
{
dx += Mode.next_move_x_plus;
Mode.next_move_x_plus = 0;
}
if (Mode.next_move_y_plus != 0)
{
dy += Mode.next_move_y_plus;
Mode.next_move_y_plus = 0;
}
{
char jumpx, jumpy;
int min_dx, max_dx, min_dy, max_dy;

View File

@ -122,7 +122,7 @@ ShowToolTip(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
Pixmap pmap, mask;
EDBUG(5, "ShowToolTip");
if (!tt)
if (!tt || Mode.mode != MODE_NONE)
EDBUG_RETURN_;
pq = Mode.queue_up;