Fix window sliding in new boxed mode.

SVN revision: 30341
This commit is contained in:
Kim Woelders 2007-06-16 08:41:53 +00:00
parent b741cd343d
commit 4c80c1de2a
7 changed files with 77 additions and 137 deletions

View File

@ -1008,7 +1008,8 @@ ArrangeEwins(const char *params)
if (Conf.place.cleanupslide)
SlideEwinTo(ewin, EoGetX(ewin), EoGetY(ewin),
ret[i].x, ret[i].y, Conf.place.slidespeedcleanup);
ret[i].x, ret[i].y, Conf.place.slidespeedcleanup,
Conf.place.slidemode);
else
EwinMove(ewin, ret[i].x, ret[i].y);
}

View File

@ -799,12 +799,10 @@ DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h,
{
static EObj *shape_win = NULL;
if (firstlast == 0 && !shape_win)
shape_win = _ShapeCreateWin();
if (!shape_win)
{
shape_win = _ShapeCreateWin();
if (!shape_win)
return;
}
return;
_ShapeSetBox(shape_win, x, y, w, h, bl, br, bt, bb, seqno);
EobjMap(shape_win, 0);

View File

@ -118,132 +118,6 @@ EwinOpFind(const char *op)
return NULL;
}
void
SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty, int speed)
{
int k, x, y, tmpx, tmpy;
char firstlast;
firstlast = 0;
Mode.place.doing_slide = 1;
FocusEnable(0);
SoundPlay("SOUND_WINDOW_SLIDE");
if (Conf.place.slidemode > 0)
EGrabServer();
tmpx = abs(tx - fx) + abs(ty - fy);
tmpx = (tmpx > 0) ? (VRoot.w + VRoot.h) / tmpx : 100;
speed *= tmpx;
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
tmpx = x;
tmpy = y;
if (Conf.place.slidemode == 0)
EoMove(ewin, tmpx, tmpy);
else
DrawEwinShape(ewin, Conf.place.slidemode, tmpx, tmpy,
ewin->client.w, ewin->client.h, firstlast, 0);
if (firstlast == 0)
firstlast = 1;
k = ETimedLoopNext();
}
ewin->state.animated = 0;
Mode.place.doing_slide = 0;
if (Conf.place.slidemode)
DrawEwinShape(ewin, Conf.place.slidemode, tx, ty,
ewin->client.w, ewin->client.h, 2, 0);
EwinOpMove(ewin, OPSRC_USER, tx, ty);
FocusEnable(1);
if (Conf.place.slidemode > 0)
EUngrabServer();
SoundPlay("SOUND_WINDOW_SLIDE_END");
}
void
SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
int speed)
{
int k, *x, *y, tmpx, tmpy, tmpw, tmph, i;
char firstlast;
if (num_wins <= 0)
return;
x = EMALLOC(int, num_wins);
y = EMALLOC(int, num_wins);
if (!x || !y)
goto done;
firstlast = 0;
Mode.place.doing_slide = 1;
FocusEnable(0);
SoundPlay("SOUND_WINDOW_SLIDE");
if (Conf.place.slidemode > 0)
EGrabServer();
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
for (i = 0; i < num_wins; i++)
{
if (!ewin[i])
continue;
x[i] = ((fx[i] * (1024 - k)) + (tx[i] * k)) >> 10;
y[i] = ((fy[i] * (1024 - k)) + (ty[i] * k)) >> 10;
tmpx = x[i];
tmpy = y[i];
tmpw = ewin[i]->client.w;
tmph = ewin[i]->client.h;
if (ewin[i]->type == EWIN_TYPE_MENU)
EoMove(ewin[i], tmpx, tmpy);
else
DrawEwinShape(ewin[i], 0, tmpx, tmpy, tmpw, tmph, firstlast, i);
if (firstlast == 0)
firstlast = 1;
}
/* We may loop faster here than originally intended */
k = ETimedLoopNext();
}
for (i = 0; i < num_wins; i++)
{
if (ewin[i])
{
DrawEwinShape(ewin[i], 0, x[i], y[i], ewin[i]->client.w,
ewin[i]->client.h, 2, i);
EwinMove(ewin[i], tx[i], ty[i]);
}
}
Mode.place.doing_slide = 0;
FocusEnable(1);
if (Conf.place.slidemode > 0)
EUngrabServer();
SoundPlay("SOUND_WINDOW_SLIDE_END");
done:
if (x)
Efree(x);
if (y)
Efree(y);
}
void
EwinFixPosition(EWin * ewin)
{

View File

@ -1843,7 +1843,7 @@ EwinSlideIn(int val __UNUSED__, void *data)
goto done;
SlideEwinTo(ewin, EoGetX(ewin), EoGetY(ewin), ewin->req_x, ewin->req_y,
Conf.place.slidespeedmap);
Conf.place.slidespeedmap, Conf.place.slidemode);
done:
Mode.place.doing_slide = 0;

View File

@ -400,9 +400,9 @@ void EwinsMoveStickyToDesk(Desk * d);
/* ewin-ops.c */
void SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty,
int speed);
int speed, int mode);
void SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx,
int *ty, int num_wins, int speed);
int *ty, int num_wins, int speed, int mode);
void EwinFixPosition(EWin * ewin);
void EwinMove(EWin * ewin, int x, int y);
void EwinResize(EWin * ewin, int w, int h);

View File

@ -1475,7 +1475,7 @@ MenusHandleMotion(void)
}
SlideEwinsTo(menus, fx, fy, tx, ty,
Mode_menus.current_depth,
Conf.shadespeed);
Conf.shadespeed, 0);
if (((xdist != 0) || (ydist != 0))
&& (Conf.menus.warp))
EXWarpPointer(None, xdist, ydist);
@ -1634,7 +1634,7 @@ SubmenuShowTimeout(int val __UNUSED__, void *dat)
/* Disable menu item events while sliding */
MenusSetEvents(0);
SlideEwinsTo(menus, fx, fy, tx, ty, i, Conf.shading.speed);
SlideEwinsTo(menus, fx, fy, tx, ty, i, Conf.shading.speed, 0);
MenusSetEvents(1);
if (Conf.menus.warp)

View File

@ -897,3 +897,70 @@ ActionsEnd(EWin * ewin)
return did_end;
}
void
SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty, int speed, int mode)
{
SlideEwinsTo(&ewin, &fx, &fy, &tx, &ty, 1, speed, mode);
}
void
SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
int speed, int mode)
{
int k, x, y, w, h, i;
char firstlast;
if (num_wins <= 0)
return;
firstlast = 0;
FocusEnable(0);
SoundPlay("SOUND_WINDOW_SLIDE");
Mode_mr.grab_server = _NeedServerGrab(mode);
if (Mode_mr.grab_server)
EGrabServer();
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
for (i = 0; i < num_wins; i++)
{
if (!ewin[i])
continue;
x = ((fx[i] * (1024 - k)) + (tx[i] * k)) >> 10;
y = ((fy[i] * (1024 - k)) + (ty[i] * k)) >> 10;
w = ewin[i]->client.w;
h = ewin[i]->client.h;
if (mode == 0)
EoMove(ewin[i], x, y);
else
DrawEwinShape(ewin[i], mode, x, y, w, h, firstlast, i);
firstlast = 1;
}
/* We may loop faster here than originally intended */
k = ETimedLoopNext();
}
for (i = 0; i < num_wins; i++)
{
if (!ewin[i])
continue;
ewin[i]->state.animated = 0;
if (mode > 0)
DrawEwinShape(ewin[i], mode, tx[i], ty[i], ewin[i]->client.w,
ewin[i]->client.h, 2, i);
EwinMove(ewin[i], tx[i], ty[i]);
}
FocusEnable(1);
if (Mode_mr.grab_server)
EUngrabServer();
SoundPlay("SOUND_WINDOW_SLIDE_END");
}