raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=d0229b3652872b0324ec4671e7469d9a9904186b

commit d0229b3652872b0324ec4671e7469d9a9904186b
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sat Feb 6 11:31:01 2016 +0900

    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.
---
 src/bin/e.h             |  1 +
 src/bin/e_client.c      | 15 +++++++++++----
 src/bin/e_comp_object.c | 11 +++++++++--
 src/bin/e_main.c        |  2 ++
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/bin/e.h b/src/bin/e.h
index 6b7ea51..f181b07 100644
--- a/src/bin/e.h
+++ b/src/bin/e.h
@@ -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;
diff --git a/src/bin/e_client.c b/src/bin/e_client.c
index c0678b9..3807910 100644
--- a/src/bin/e_client.c
+++ b/src/bin/e_client.c
@@ -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 */
diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
index 06b6943..fb3197c 100644
--- a/src/bin/e_comp_object.c
+++ b/src/bin/e_comp_object.c
@@ -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;
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index 772e119..e1a80c8 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -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

-- 


Reply via email to