e - restart window positioning - fix it

so every time i restart e i have my windows all messed up. it's
INSANELY annoying and time consuming every single time having to move
a dozen or more windows back to where they should be just because i
restarted e. i've narrowed it down to 2 places. 1 which is trying to
handle "out of screen" windows and during startup it seems things are
not quite stable yet as the randr code figures things out until the
event storm settles down.

when this is then fixed - another bit of code just shuffles windows up
all the time by a titlebar whcih is also supremely annoying. this is
the code that adopes a new frame for a window.

so the nasty hack to avoid piles of pain right now is for the first 5
seconds of e's life - don't do this stuff. at least you can now use e
and not be annoyed to hell and back every restart.

yes a nicer fix may be better - but that's going to take a lot more
time and patience and until then - this will do.
This commit is contained in:
Carsten Haitzler 2016-02-06 11:31:01 +09:00
parent e75af1536d
commit d0229b3652
4 changed files with 23 additions and 6 deletions

View File

@ -313,6 +313,7 @@ extern E_API Eina_Bool starting;
extern E_API Eina_Bool stopping;
extern E_API Eina_Bool restart;
extern E_API Eina_Bool e_nopause;
extern E_API double e_main_loop_started;
extern E_API Eina_Bool e_precache_end;
extern E_API Eina_Bool x_fatal;

View File

@ -1876,10 +1876,17 @@ _e_client_eval(E_Client *ec)
}
else if (!E_INSIDE(ec->x, ec->y, zx, zy, zw, zh))
{
/* If an ec is placed out of bound, fix it! */
ec->x = zx + ((zw - ec->w) / 2);
ec->y = zy + ((zh - ec->h) / 2);
ec->changes.pos = 1;
// FIXME: this causes initial positioning of windows to be broken on restart
if (!((ecore_time_get() - e_main_loop_started) < 5.0))
// if during the startup phase and inital event burst
// big nasty hack - assume 5 seconds ... then DONT do this
// because otherwise windows just shuffle into the center
{
/* If an ec is placed out of bound, fix it! */
ec->x = zx + ((zw - ec->w) / 2);
ec->y = zy + ((zh - ec->h) / 2);
ec->changes.pos = 1;
}
}
/* Recreate state */

View File

@ -3286,8 +3286,15 @@ reshadow:
_e_comp_smart_cb_frame_recalc(cw, cw->smart_obj, NULL);
if ((cw->x == -1) && (cw->y == -1) && cw->ec->new_client && (!cw->ec->placed))
{
cw->ec->x = MAX(cw->ec->zone->x, cw->ec->client.x - cw->client_inset.l);
cw->ec->y = MAX(cw->ec->zone->y, cw->ec->client.y - cw->client_inset.t);
// FIXME: this causes windows to move up by a titlebar height each restart
if (!((ecore_time_get() - e_main_loop_started) < 5.0))
// if during the startup phase and inital event burst
// big nasty hack - assume 5 seconds ... then DONT do this
// because every restart otherwise windows just shift up and up
{
cw->ec->x = MAX(cw->ec->zone->x, cw->ec->client.x - cw->client_inset.l);
cw->ec->y = MAX(cw->ec->zone->y, cw->ec->client.y - cw->client_inset.t);
}
}
/* this guarantees that we won't get blocked by the NOP check in the interceptor */
cw->y = cw->x = -99999;

View File

@ -111,6 +111,7 @@ E_API Eina_Bool starting = EINA_TRUE;
E_API Eina_Bool stopping = EINA_FALSE;
E_API Eina_Bool restart = EINA_FALSE;
E_API Eina_Bool e_nopause = EINA_FALSE;
E_API double e_main_loop_started = 0.0;
EINTERN const char *e_first_frame = NULL;
EINTERN double e_first_frame_start_time = -1;
@ -1058,6 +1059,7 @@ main(int argc, char **argv)
e_util_env_set("E_RESTART", "1");
TS("MAIN LOOP AT LAST");
e_main_loop_started = ecore_time_get();
if (!setjmp(x_fatal_buff))
ecore_main_loop_begin();
else