ecore_evas - ecore_evas's should start withdrawn then normal on show
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 29 Oct 2014 10:33:16 +0000 (19:33 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 29 Oct 2014 10:34:33 +0000 (19:34 +0900)
this fixes initial state of an ee where you couldn't detect when the
window had been accepted by the wm (goes to normal state from
withdrawn).

@fix

src/lib/ecore_evas/ecore_evas_buffer.c
src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
src/modules/ecore_evas/engines/x/ecore_evas_x.c

index dc23312..01b33a0 100644 (file)
@@ -107,6 +107,8 @@ _ecore_evas_show(Ecore_Evas *ee)
    if (bdata->image) return;
    if (ee->prop.focused) return;
    ee->prop.focused = EINA_TRUE;
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    evas_focus_in(ee->evas);
    if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
 }
@@ -430,6 +432,8 @@ _ecore_evas_buffer_cb_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN
    Ecore_Evas *ee;
 
    ee = data;
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
 }
@@ -440,6 +444,8 @@ _ecore_evas_buffer_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EIN
    Ecore_Evas *ee;
 
    ee = data;
+   ee->prop.withdrawn = EINA_TRUE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 0;
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
 }
@@ -790,7 +796,7 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
    ee->prop.override = EINA_TRUE;
    ee->prop.maximized = EINA_FALSE;
    ee->prop.fullscreen = EINA_FALSE;
-   ee->prop.withdrawn = EINA_FALSE;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->prop.sticky = EINA_FALSE;
 
    /* init evas here */
index 9813d5b..2c0d724 100644 (file)
@@ -536,6 +536,7 @@ ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int
   ee->prop.request_pos = EINA_FALSE;
   ee->prop.sticky = EINA_FALSE;
   ee->prop.window = 0;
+  ee->prop.withdrawn = EINA_TRUE;
 
   printf("Create New Evas\n");
 
index 3bb42a8..e47283e 100644 (file)
@@ -212,6 +212,7 @@ ecore_evas_drm_new_internal(const char *device, unsigned int parent EINA_UNUSED,
    ee->prop.layer = 4;
    ee->prop.request_pos = 0;
    ee->prop.sticky = 0;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->alpha = EINA_FALSE;
 
    ee->can_async_render = 1;
@@ -357,6 +358,7 @@ ecore_evas_gl_drm_new_internal(const char *device, unsigned int parent EINA_UNUS
    ee->prop.layer = 4;
    ee->prop.request_pos = 0;
    ee->prop.sticky = 0;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->alpha = EINA_FALSE;
 
    ee->can_async_render = 1;
@@ -665,6 +667,8 @@ _ecore_evas_drm_show(Ecore_Evas *ee)
 {
    if ((!ee) || (ee->visible)) return;
    evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
 }
@@ -674,6 +678,8 @@ _ecore_evas_drm_hide(Ecore_Evas *ee)
 {
    if ((!ee) || (!ee->visible)) return;
    evas_sync(ee->evas);
+   ee->prop.withdrawn = EINA_TRUE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 0;
    ee->should_be_visible = 0;
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
index c0b79ae..a524a43 100644 (file)
@@ -1164,7 +1164,7 @@ ecore_evas_extn_plug_new_internal(Ecore_Evas *ee_target)
    ee->prop.override = EINA_TRUE;
    ee->prop.maximized = EINA_FALSE;
    ee->prop.fullscreen = EINA_FALSE;
-   ee->prop.withdrawn = EINA_FALSE;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->prop.sticky = EINA_FALSE;
 
    bdata->image = o;
@@ -1591,6 +1591,8 @@ _ipc_client_data(void *data, int type EINA_UNUSED, void *event)
       case OP_SHOW:
          if (!ee->visible)
            {
+              ee->prop.withdrawn = EINA_FALSE;
+              if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
               ee->visible = 1;
               if (ee->func.fn_show) ee->func.fn_show(ee);
            }
@@ -1598,6 +1600,8 @@ _ipc_client_data(void *data, int type EINA_UNUSED, void *event)
       case OP_HIDE:
          if (ee->visible)
            {
+              ee->prop.withdrawn = EINA_TRUE;
+              if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
               ee->visible = 0;
               if (ee->func.fn_hide) ee->func.fn_hide(ee);
            }
index db0f7e7..5373dd7 100644 (file)
@@ -395,6 +395,8 @@ static void
 _ecore_evas_show(Ecore_Evas *ee)
 {
    if (ee->prop.focused) return;
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->prop.focused = EINA_TRUE;
    evas_focus_in(ee->evas);
    if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
@@ -403,6 +405,8 @@ _ecore_evas_show(Ecore_Evas *ee)
 static void
 _ecore_evas_hide(Ecore_Evas *ee)
 {
+   ee->prop.withdrawn = EINA_TRUE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    if (ee->prop.focused)
      {
         ee->prop.focused = EINA_FALSE;
@@ -659,7 +663,7 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
    ee->prop.override = EINA_TRUE;
    ee->prop.maximized = EINA_TRUE;
    ee->prop.fullscreen = EINA_FALSE;
-   ee->prop.withdrawn = EINA_FALSE;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->prop.sticky = EINA_FALSE;
 
    /* init evas here */
index 4b589d8..71de3b9 100644 (file)
@@ -289,6 +289,8 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x EINA_UNUSED, int y EINA_UNUSED, in
 static void
 _ecore_evas_show(Ecore_Evas *ee)
 {
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    if (ee->prop.focused) return;
    ee->prop.focused = EINA_TRUE;
    evas_focus_in(ee->evas);
@@ -465,7 +467,7 @@ ecore_evas_psl1ght_new_internal(const char *name, int w, int h)
    ee->prop.override = EINA_TRUE;
    ee->prop.maximized = EINA_TRUE;
    ee->prop.fullscreen = EINA_FALSE;
-   ee->prop.withdrawn = EINA_FALSE;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->prop.sticky = EINA_FALSE;
    ee->prop.window = 0;
 
index 218eab0..4ffbf3d 100644 (file)
@@ -387,6 +387,8 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
 static void
 _ecore_evas_show(Ecore_Evas *ee)
 {
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    if (ee->prop.focused) return;
    ee->prop.focused = EINA_TRUE;
    evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
@@ -568,7 +570,7 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
    ee->prop.override = EINA_TRUE;
    ee->prop.maximized = EINA_TRUE;
    ee->prop.fullscreen = fullscreen;
-   ee->prop.withdrawn = EINA_FALSE;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->prop.sticky = EINA_FALSE;
    ee->prop.window = 0;
    ee->alpha = alpha;
index 592609f..6dd28fa 100644 (file)
@@ -163,6 +163,7 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
    ee->prop.request_pos = EINA_FALSE;
    ee->prop.sticky = EINA_FALSE;
    ee->prop.draw_frame = frame;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->alpha = EINA_FALSE;
 
    /* NB: Disabled for right now as it causes textgrid (terminology) 
@@ -330,6 +331,8 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
         evas_object_resize(wdata->frame, ee->w + fw, ee->h + fh);
      }
 
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
 }
@@ -357,6 +360,8 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
    if (wdata->win) 
      ecore_wl_window_hide(wdata->win);
 
+   ee->prop.withdrawn = EINA_TRUE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 0;
    ee->should_be_visible = 0;
    _ecore_evas_wl_common_frame_callback_clean(ee);
index 772bd3c..5f99f7a 100644 (file)
@@ -160,6 +160,7 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
    ee->prop.request_pos = EINA_FALSE;
    ee->prop.sticky = EINA_FALSE;
    ee->prop.draw_frame = frame;
+   ee->prop.withdrawn = EINA_TRUE;
    ee->alpha = EINA_FALSE;
 
    if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER"))
@@ -322,6 +323,8 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
         evas_object_resize(wdata->frame, ee->w + fw, ee->h + fh);
      }
 
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
 }
@@ -349,6 +352,8 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
    if (wdata->win) 
      ecore_wl_window_hide(wdata->win);
 
+   ee->prop.withdrawn = EINA_TRUE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    ee->visible = 0;
    ee->should_be_visible = 0;
    _ecore_evas_wl_common_frame_callback_clean(ee);
index 564638c..88397c7 100644 (file)
@@ -318,6 +318,8 @@ _ecore_evas_win32_event_window_show(void *data EINA_UNUSED, int type EINA_UNUSED
    ee = ecore_event_window_match((Ecore_Window)e->window);
    if (!ee) return 1; /* pass on event */
    if ((Ecore_Window)e->window != ee->prop.window) return 1;
+   ee->prop.withdrawn = EINA_FALSE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    if (ee->visible) return 0; /* dont pass it on */
    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
@@ -337,6 +339,8 @@ _ecore_evas_win32_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED
    ee = ecore_event_window_match((Ecore_Window)e->window);
    if (!ee) return 1; /* pass on event */
    if ((Ecore_Window)e->window != ee->prop.window) return 1;
+   ee->prop.withdrawn = EINA_TRUE;
+   if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
    if (!ee->visible) return 0; /* dont pass it on */
    ee->visible = 0;
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
@@ -1307,6 +1311,7 @@ _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_backend_init)(Ecore_Evas
    ee->prop.sticky = EINA_FALSE;
    /* FIXME: sticky to add */
    ee->prop.window = 0;
+   ee->prop.withdrawn = EINA_TRUE;
 
    /* init evas here */
    ee->evas = evas_new();
index 26593bf..81e6208 100644 (file)
@@ -1642,6 +1642,11 @@ _ecore_evas_x_event_window_show(void *data EINA_UNUSED, int type EINA_UNUSED, vo
      }
    if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11")))
      evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+   if (ee->prop.override)
+     {
+        ee->prop.withdrawn = EINA_FALSE;
+        if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+     }
    if (ee->visible) return ECORE_CALLBACK_PASS_ON;
 //   if (ee->visible) return ECORE_CALLBACK_DONE;
 //   printf("SHOW EVENT %p\n", ee);
@@ -1668,6 +1673,11 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, vo
         if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
         ee->in = EINA_FALSE;
      }
+   if (ee->prop.override)
+     {
+        ee->prop.withdrawn = EINA_TRUE;
+        if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
+     }
    if (!ee->visible) return ECORE_CALLBACK_PASS_ON;
 //   if (!ee->visible) return ECORE_CALLBACK_DONE;
 //   printf("HIDE EVENT %p\n", ee);
@@ -3837,6 +3847,7 @@ ecore_evas_software_x11_new_internal(const char *disp_name, Ecore_X_Window paren
    ee->prop.layer = 4;
    ee->prop.request_pos = EINA_FALSE;
    ee->prop.sticky = 0;
+   ee->prop.withdrawn = EINA_TRUE;
    edata->state.sticky = 0;
 
    if (getenv("ECORE_EVAS_FORCE_SYNC_RENDER"))
@@ -4372,6 +4383,7 @@ ecore_evas_gl_x11_options_new_internal(const char *disp_name, Ecore_X_Window par
    ee->prop.layer = 4;
    ee->prop.request_pos = EINA_FALSE;
    ee->prop.sticky = 0;
+   ee->prop.withdrawn = EINA_TRUE;
    edata->state.sticky = 0;
 
    /* init evas here */