ecore_wl2: Add API ecore_wl2_window_commit()

Abstract wl_surface commits in ecore_wl2_window.
This commit is contained in:
Derek Foreman 2017-08-14 17:44:13 -05:00
parent e3b9fbaed8
commit 11d3bf7939
3 changed files with 36 additions and 0 deletions

View File

@ -1873,6 +1873,24 @@ EAPI void ecore_wl2_offer_finish(Ecore_Wl2_Offer *offer);
*/
EAPI void ecore_wl2_session_recovery_disable(void);
/**
* Commit the surface of a wayland window.
*
* If flush is set this generates a wl_surface_commit(), otherwise it is
* expected that some other call in the very near future (such as
* eglSwapBuffers) will cause an implicit flush.
*
* A surface that has been commit will be in the "pending" state until
* the compositor tells us it's time to draw again via a frame callback.
*
* @surface surface to commit
* @flush EINA_TRUE if we need to flush immediately.
*
* @since 1.20
*/
EAPI void ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush);
/**
# endif
# undef EAPI

View File

@ -155,6 +155,7 @@ struct _Ecore_Wl2_Window
const char *role;
struct wl_surface *surface;
struct wl_callback *callback;
struct www_surface *www_surface;
struct zxdg_surface_v6 *zxdg_surface;
struct zxdg_toplevel_v6 *zxdg_toplevel;
@ -199,6 +200,8 @@ struct _Ecore_Wl2_Window
Eina_Bool focus_skip : 1;
Eina_Bool floating : 1;
Eina_Bool commit_pending : 1;
struct
{
Eina_Bool configure : 1;

View File

@ -535,6 +535,7 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
{
wl_surface_attach(window->surface, NULL, 0, 0);
wl_surface_commit(window->surface);
window->commit_pending = EINA_FALSE;
}
window->configure_serial = 0;
@ -1342,3 +1343,17 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int
if (window->display->wl.efl_hints && window->zxdg_toplevel)
efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, w, h, aspect);
}
EAPI void ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush)
{
EINA_SAFETY_ON_NULL_RETURN(window);
EINA_SAFETY_ON_NULL_RETURN(window->surface);
if (window->commit_pending) ERR("Commit before previous commit processed");
window->commit_pending = EINA_TRUE;
window->callback = wl_surface_frame(window->surface);
wl_callback_add_listener(window->callback, &_frame_listener, window);
if (flush) wl_surface_commit(window->surface);
}