forked from e16/e16
1
0
Fork 0

Fix various window slidein issues.

SVN revision: 15011
This commit is contained in:
Kim Woelders 2005-05-29 10:20:25 +00:00
parent d04f70aca9
commit 5480957906
4 changed files with 58 additions and 18 deletions

View File

@ -1745,6 +1745,7 @@ EWin **ListGroupMembers(Window win, int *num);
#define FOCUS_PREV 9
#define FOCUS_CLICK 10
void FocusEnable(int on);
void FocusGetNextEwin(void);
void FocusGetPrevEwin(void);
void FocusEwinSetGrabs(EWin * ewin);

View File

@ -98,6 +98,7 @@ SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty, int speed)
firstlast = 0;
Mode.doingslide = 1;
FocusEnable(0);
SoundPlay("SOUND_WINDOW_SLIDE");
if (Conf.slidemode > 0)
@ -122,7 +123,9 @@ SlideEwinTo(EWin * ewin, int fx, int fy, int tx, int ty, int speed)
}
DrawEwinShape(ewin, Conf.slidemode, x, y, ewin->client.w, ewin->client.h, 2);
MoveEwin(ewin, tx, ty);
Mode.doingslide = 0;
FocusEnable(1);
if (Conf.slidemode > 0)
EUngrabServer();
@ -134,17 +137,20 @@ void
SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
int speed)
{
int k, *x = NULL, *y = NULL, tmpx, tmpy, tmpw, tmph, i;
int k, *x, *y, tmpx, tmpy, tmpw, tmph, i;
char firstlast;
if (num_wins)
{
x = Emalloc(sizeof(int) * num_wins);
y = Emalloc(sizeof(int) * num_wins);
}
if (num_wins <= 0)
return;
x = Emalloc(sizeof(int) * num_wins);
y = Emalloc(sizeof(int) * num_wins);
if (!x || !y)
goto done;
firstlast = 0;
Mode.doingslide = 1;
FocusEnable(0);
SoundPlay("SOUND_WINDOW_SLIDE");
if (Conf.slidemode > 0)
@ -186,11 +192,14 @@ SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
}
Mode.doingslide = 0;
FocusEnable(1);
if (Conf.slidemode > 0)
EUngrabServer();
SoundPlay("SOUND_WINDOW_SLIDE_END");
done:
if (x)
Efree(x);
if (y)

View File

@ -42,6 +42,8 @@
/* StructureNotifyMask | */ ResizeRedirectMask | \
PropertyChangeMask | ColormapChangeMask | VisibilityChangeMask)
static void EwinSlideIn(int val __UNUSED__, void *data);
static void EwinChangesStart(EWin * ewin);
static void EwinChangesProcess(EWin * ewin);
@ -815,10 +817,12 @@ AddToFamily(EWin * ewin, Window win)
fx = VRoot.w;
fy = (rand() % (VRoot.h)) - EoGetH(ewin);
}
FocusEnable(0);
MoveEwinToDesktopAt(ewin, desk, fx, fy);
ShowEwin(ewin);
SlideEwinTo(ewin, fx, fy, x, y, Conf.slidespeedmap);
MoveEwinToDesktopAt(ewin, desk, x, y);
ewin->req_x = x;
ewin->req_y = y;
DoIn("Slide", 0.05, EwinSlideIn, 0, ewin);
}
else
{
@ -1517,6 +1521,19 @@ EwinRememberPositionGet(EWin * ewin, int *px, int *py)
*py = y;
}
/*
* Slidein
*/
static void
EwinSlideIn(int val __UNUSED__, void *data)
{
EWin *ewin = data;
SlideEwinTo(ewin, EoGetX(ewin), EoGetY(ewin), ewin->req_x, ewin->req_y,
Conf.slidespeedmap);
FocusEnable(1);
}
/*
* Change requests
*/

View File

@ -23,9 +23,26 @@
*/
#include "E.h"
static int focus_enable = 0;
static int focus_inhibit = 1;
static int focus_new_desk_nesting = 0;
void
FocusEnable(int on)
{
if (on)
{
if (focus_inhibit > 0)
focus_inhibit--;
}
else
{
focus_inhibit++;
}
if (EventDebug(EDBUG_TYPE_FOCUS))
Eprintf("FocusEnable inhibit=%d\n", focus_inhibit);
}
/*
* Return !0 if it is OK to focus ewin.
* on_screen: Require window to be on-screen now
@ -216,6 +233,9 @@ FocusToEWin(EWin * ewin, int why)
int do_follow = 0;
int do_raise = 0, do_warp = 0;
if (focus_inhibit)
return;
if (EventDebug(EDBUG_TYPE_FOCUS))
{
if (ewin)
@ -225,9 +245,6 @@ FocusToEWin(EWin * ewin, int why)
Eprintf("FocusToEWin None why=%d\n", why);
}
if (!focus_enable)
return;
switch (why)
{
case FOCUS_NEXT:
@ -272,10 +289,6 @@ FocusToEWin(EWin * ewin, int why)
break;
case FOCUS_EWIN_NEW:
/* Don't chase around after the windows at startup */
if (Mode.wm.startup || Mode.doingslide)
return;
if (Conf.focus.all_new_windows_get_focus)
{
do_follow = 2;
@ -400,7 +413,7 @@ FocusInit(void)
EWin *ewin;
/* Start focusing windows */
focus_enable = 1;
FocusEnable(1);
/* Set the mouse-over window */
ewin = GetEwinByCurrentPointer();
@ -867,7 +880,7 @@ FocusSighan(int sig, void *prm __UNUSED__)
{
case ESIGNAL_START:
/* Delay focusing a bit to allow things to settle down */
DoIn("FOCUS_INIT_TIMEOUT", 1., FocusInitTimeout, 0, NULL);
DoIn("FOCUS_INIT_TIMEOUT", 0.5, FocusInitTimeout, 0, NULL);
break;
case ESIGNAL_EXIT: