ecore_evas/wayland: Add a function to cleanup the frame callback.

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.
This commit is contained in:
Rafael Antognolli 2013-12-02 17:39:24 -02:00
parent 77a4654470
commit 615d5ab634
4 changed files with 22 additions and 5 deletions

View 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 =

View 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);
}

View 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);

View 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);
}