ecore_evas/wayland: Add a function to cleanup the frame callback.
authorRafael Antognolli <rafael.antognolli@intel.com>
Mon, 2 Dec 2013 19:39:24 +0000 (17:39 -0200)
committerRafael Antognolli <rafael.antognolli@intel.com>
Mon, 2 Dec 2013 19:54:29 +0000 (17:54 -0200)
This callback must be manually destroyed and removed on
ecore_evas_hide(), because it won't be delivered anymore after the
surface is destroyed. If the callback still exists, the engine will find
it and avoid doing a new redraw until it is finally called.

Maybe the correct thing to do is to keep this callback in the
Ecore_Wl_Window struct, and have some functions to set/unset it, so it
gets destroyed when the window is hidden. Or when the surface is
destroyed.

src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c

index 189f382..2fcad77 100644 (file)
@@ -1200,21 +1200,34 @@ _ecore_evas_wl_common_post_render(Ecore_Evas *ee)
    if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
 }
 
+void
+_ecore_evas_wl_common_frame_callback_clean(Ecore_Evas *ee)
+{
+   Ecore_Evas_Engine_Wl_Data *wdata;
+
+   wdata = ee->engine.data;
+
+   if (!wdata->frame_pending)
+     return;
+   wl_callback_destroy(wdata->frame_callback);
+   wdata->frame_callback = NULL;
+   wdata->frame_pending = EINA_FALSE;
+}
+
 static void
-_ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t tm EINA_UNUSED)
+_ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback EINA_UNUSED, uint32_t tm EINA_UNUSED)
 {
    Ecore_Evas *ee = data;
    Ecore_Wl_Window *win = NULL;
    Ecore_Evas_Engine_Wl_Data *wdata;
 
    if (!ee) return;
+
+   _ecore_evas_wl_common_frame_callback_clean(ee);
+
    wdata = ee->engine.data;
    if (!(win = wdata->win)) return;
 
-   wdata->frame_callback = NULL;
-   wdata->frame_pending = EINA_FALSE;
-   wl_callback_destroy(callback);
-
    if (ecore_wl_window_surface_get(win))
      {
         wdata->frame_callback = 
index 335111c..a9a1776 100644 (file)
@@ -344,6 +344,7 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
 
    ee->visible = 0;
    ee->should_be_visible = 0;
+   _ecore_evas_wl_common_frame_callback_clean(ee);
 
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
 }
index edf7be2..a48bdb2 100644 (file)
@@ -78,6 +78,8 @@ void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize
 void _ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, int borderless);
 void _ecore_evas_wl_common_withdrawn_set(Ecore_Evas *ee, int val);
 
+void _ecore_evas_wl_common_frame_callback_clean(Ecore_Evas *ee);
+
 Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas);
 void _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh);
 
index c4b7fbc..e091830 100644 (file)
@@ -343,6 +343,7 @@ _ecore_evas_wl_hide(Ecore_Evas *ee)
 
    ee->visible = 0;
    ee->should_be_visible = 0;
+   _ecore_evas_wl_common_frame_callback_clean(ee);
 
    if (ee->func.fn_hide) ee->func.fn_hide(ee);
 }