ecore_wl2: Add new API to latch window state for updates

Add an API to call at the beginning of render to latch state at
that moment, and use it for the wayland engine.
This commit is contained in:
Derek Foreman 2017-10-04 13:46:34 -05:00
parent 0badc0522b
commit 0a185d3efd
4 changed files with 26 additions and 0 deletions

View File

@ -1957,6 +1957,21 @@ EAPI void ecore_wl2_display_flush(Ecore_Wl2_Display *display);
EAPI Eina_Bool ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window);
/**
* Latch window state at the start of an update
*
* When async render takes place we continue to dispatch wayland
* events from the main loop. We need to defer any changes to
* window state from those events until the update is complete.
*
* Events deferred during an update will automatically fire
* immediately after the caller calls ecore_wl2_window_commit.
*
* @param window
* @since 1.21
*/
EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window);
# endif
# undef EAPI

View File

@ -233,6 +233,7 @@ struct _Ecore_Wl2_Window
unsigned int count;
} wm_rot;
Eina_Bool has_buffer : 1;
Eina_Bool updating : 1;
};
struct _Ecore_Wl2_Output

View File

@ -1408,6 +1408,7 @@ ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush)
wl_surface_commit(window->surface);
ecore_wl2_display_flush(window->display);
}
window->updating = EINA_FALSE;
}
EAPI Eina_Bool
@ -1468,3 +1469,11 @@ ecore_wl2_window_resizing_get(Ecore_Wl2_Window *window)
return window->req_config.resizing;
}
EAPI void ecore_wl2_window_update_begin(Ecore_Wl2_Window *window)
{
EINA_SAFETY_ON_NULL_RETURN(window);
EINA_SAFETY_ON_TRUE_RETURN(window->updating);
window->updating = EINA_TRUE;
}

View File

@ -1710,6 +1710,7 @@ _ecore_evas_wl_common_render_flush_pre(void *data, Evas *evas, void *event EINA_
if (!ecore_wl2_window_shell_surface_exists(wdata->win)) return;
ecore_wl2_window_update_begin(wdata->win);
if (wdata->win->zxdg_configure_ack && wdata->win->req_config.serial &&
(wdata->win->req_config.serial != wdata->win->set_config.serial))
wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface,