Revert "Fix window hide/show() using withdrawn_set()" 66/13666/1
authorRusty Lynch <rusty.lynch@intel.com>
Wed, 11 Dec 2013 22:48:20 +0000 (14:48 -0800)
committerRusty Lynch <rusty.lynch@intel.com>
Thu, 12 Dec 2013 01:07:33 +0000 (17:07 -0800)
This reverts commit 636114eb7c7925e71a8e29ce0e88f753270fb50f.

When testing this on the current stack using real hardware it become
obvious that the implementation was broken when using wayland_egl backend.
This should be resubmitted once it works with the wayland_egl backend
and has been unit tested using the default image configurations.

Change-Id: I44fc444cd9006836d7be8862f067406ff4617e4f

src/lib/ecore_evas/ecore_evas_wayland_egl.c
src/lib/ecore_evas/ecore_evas_wayland_shm.c

index 5d34943..2b31675 100644 (file)
@@ -95,14 +95,12 @@ static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
 static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
 static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
 static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
-static void _ecore_evas_wl_withdrawn_set(Ecore_Evas *ee, int val);
 static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
 static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
 static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
 static int _ecore_evas_wl_render(Ecore_Evas *ee);
 static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
 static void _ecore_evas_wl_screen_dpi_get(const Ecore_Evas *ee __UNUSED__, int *xdpi, int *ydpi);
-static void _ecore_evas_wl_frame_callback_clean(Ecore_Evas *ee);
 static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
 static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
 static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
@@ -168,7 +166,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    _ecore_evas_wl_maximized_set,
    _ecore_evas_wl_fullscreen_set,
    NULL, // func avoid_damage set
-   _ecore_evas_wl_withdrawn_set,
+   NULL, // func withdrawn set
    NULL, // func sticky set
    _ecore_evas_wl_ignore_events_set,
    _ecore_evas_wl_alpha_set,
@@ -581,6 +579,14 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
      {
         ecore_wl_window_show(ee->engine.wl.win);
         ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
+        ecore_wl_window_buffer_attach(ee->engine.wl.win, NULL, 0, 0);
+
+        if ((ee->prop.clas) && (ee->engine.wl.win->shell_surface))
+          wl_shell_surface_set_class(ee->engine.wl.win->shell_surface, 
+                                     ee->prop.clas);
+        if ((ee->prop.title) && (ee->engine.wl.win->shell_surface))
+          wl_shell_surface_set_title(ee->engine.wl.win->shell_surface, 
+                                     ee->prop.title);
      }
 
    if (ee->engine.wl.frame)
@@ -605,9 +611,6 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
         /*   printf("Failed to get a Surface from Ecore_Wl\n"); */
      }
 
-        /* force an update to push events, especially useful for wayland_egl */
-   evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
-
    ee->visible = 1;
    if (ee->func.fn_show) ee->func.fn_show(ee);
 }
@@ -633,7 +636,6 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
 
    ee->visible = 0;
    ee->should_be_visible = 0;
-   _ecore_evas_wl_frame_callback_clean (ee);
 
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
 }
@@ -789,17 +791,6 @@ _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
      ee->func.fn_state_change(ee);
 }
 
-static void
-_ecore_evas_wl_withdrawn_set(Ecore_Evas *ee, int val)
-{
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if (val)
-     ecore_evas_hide(ee);
-   else
-     ecore_evas_show(ee);
-}
-
 static void 
 _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
 {
@@ -861,33 +852,19 @@ static const struct wl_callback_listener frame_listener = {
 };
 
 static void
-_ecore_evas_wl_frame_callback_clean(Ecore_Evas *ee)
+_ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t time __UNUSED__)
 {
+   Ecore_Evas *ee = data;
    Ecore_Wl_Window *win = ee->engine.wl.win;
 
-   if (!win->frame_pending)
-     return;
-   wl_callback_destroy(win->frame_callback);
    win->frame_callback = NULL;
-   win->frame_pending = EINA_FALSE;   
-}
+   win->frame_pending = EINA_FALSE;
+   wl_callback_destroy(callback);
 
-static void
-_ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback __UNUSED__, uint32_t time __UNUSED__)
-{
-   Ecore_Evas *ee = data;
-   Ecore_Wl_Window *win = NULL;
-
-   if (!ee) return;
-
-   _ecore_evas_wl_frame_callback_clean(ee);
-
-   if (!(win = ee->engine.wl.win)) return;
-
-   if (ecore_wl_window_surface_get(win))
+   if (win->surface)
      {
-       win->frame_callback =
-           wl_surface_frame(ecore_wl_window_surface_get(win));
+        win->frame_callback =
+           wl_surface_frame(win->surface);
         wl_callback_add_listener(win->frame_callback,
                                  &frame_listener, ee);
      }
@@ -900,10 +877,7 @@ _ecore_evas_wl_render(Ecore_Evas *ee)
 
    if (!ee) return 0;
    if (!ee->visible)
-     {
-       evas_norender(ee->evas);
-       return 0;
-     }
+     evas_norender(ee->evas);
    else
      {
         Eina_List *ll = NULL, *updates = NULL;
index 626c7f6..65ef1ca 100644 (file)
@@ -101,7 +101,6 @@ static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
 static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
 static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
 static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
-static void _ecore_evas_wl_withdrawn_set(Ecore_Evas *ee, int val);
 static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
 static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
 static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
@@ -112,7 +111,6 @@ static void _ecore_evas_wl_ensure_pool_size(Ecore_Evas *ee, int w, int h);
 static struct wl_shm_pool *_ecore_evas_wl_shm_pool_create(int size, void **data);
 
 static void _ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t tm EINA_UNUSED);
-static void _ecore_evas_wl_frame_callback_clean(Ecore_Evas *ee);
 
 static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, struct wl_shm_pool *pool);
 
@@ -186,7 +184,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    _ecore_evas_wl_maximized_set,
    _ecore_evas_wl_fullscreen_set,
    NULL, // func avoid_damage set
-   _ecore_evas_wl_withdrawn_set,
+   NULL, // func withdrawn set
    NULL, // func sticky set
    _ecore_evas_wl_ignore_events_set,
    _ecore_evas_wl_alpha_set,
@@ -696,6 +694,11 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
 
    if ((!ee) || (!ee->visible)) return;
 
+   if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
+   ee->engine.wl.buffer = NULL;
+
+   munmap(ee->engine.wl.pool_data, ee->engine.wl.pool_size);
+
    einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
    if ((einfo) && (einfo->info.dest))
      {
@@ -703,12 +706,10 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
         evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
      }
 
-   if (ee->engine.wl.win)
-      ecore_wl_window_hide(ee->engine.wl.win);
+   ecore_wl_window_hide(ee->engine.wl.win);
 
    ee->visible = 0;
    ee->should_be_visible = 0;
-   _ecore_evas_wl_frame_callback_clean (ee);
 
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
 }
@@ -863,17 +864,6 @@ _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
      ee->func.fn_state_change(ee);
 }
 
-static void
-_ecore_evas_wl_withdrawn_set(Ecore_Evas *ee, int val)
-{
-   LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
-   if (val)
-     ecore_evas_hide(ee);
-   else
-     ecore_evas_show(ee);
-}
-
 static void 
 _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
 {
@@ -972,19 +962,7 @@ _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
 }
 
 static void
-_ecore_evas_wl_frame_callback_clean(Ecore_Evas *ee)
-{
-   Ecore_Wl_Window *win = ee->engine.wl.win;
-
-   if (!win->frame_pending)
-     return;
-   wl_callback_destroy(win->frame_callback);
-   win->frame_callback = NULL;
-   win->frame_pending = EINA_FALSE;
-}
-
-static void
-_ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback EINA_UNUSED, uint32_t tm EINA_UNUSED)
+_ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t tm EINA_UNUSED)
 {
    Ecore_Evas *ee = data;
    Ecore_Wl_Window *win = NULL;
@@ -992,7 +970,9 @@ _ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback EINA_UNUS
    if (!ee) return;
    if (!(win = ee->engine.wl.win)) return;
 
-   _ecore_evas_wl_frame_callback_clean(ee);
+   win->frame_callback = NULL;
+   win->frame_pending = EINA_FALSE;
+   wl_callback_destroy(callback);
 
    if (win->surface)
      {