ecore_wl2: Add ecore_wl2_display_flush() api

Allowing engines to explicitly flush at the right times will remove some
awkwardness and bugs from our current display flush paradigm
This commit is contained in:
Derek Foreman 2017-08-30 12:24:16 -05:00
parent 388f8c41c8
commit e7db6eec46
2 changed files with 33 additions and 0 deletions

View File

@ -1943,6 +1943,18 @@ EAPI void ecore_wl2_window_frame_callback_del(Ecore_Wl2_Frame_Cb_Handle *handle)
*/
EAPI void ecore_wl2_window_buffer_attach(Ecore_Wl2_Window *win, void *buffer, int x, int y, Eina_Bool implicit);
/**
* Push buffered wayland protocol to compositor
*
* Wayland protocol is only actually sent when a flush occurs,
* so the display should be flushed at appropriate times, such
* as after a commit.
*
* @param display
* @since 1.20
*/
EAPI void ecore_wl2_display_flush(Ecore_Wl2_Display *display);
# endif
# undef EAPI

View File

@ -1111,3 +1111,24 @@ ecore_wl2_display_name_get(const Ecore_Wl2_Display *display)
EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
return display->name;
}
EAPI void
ecore_wl2_display_flush(Ecore_Wl2_Display *display)
{
int ret, code;
EINA_SAFETY_ON_NULL_RETURN(display);
ret = wl_display_flush(display->wl.display);
if (ret >= 0) return;
code = errno;
if (code == EAGAIN)
{
ecore_main_fd_handler_active_set(display->fd_hdl,
(ECORE_FD_READ | ECORE_FD_WRITE));
return;
}
_begin_recovery_maybe(display, code);
}