From e7db6eec4607e78fa2e5160590f0b47b09379d93 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 30 Aug 2017 12:24:16 -0500 Subject: [PATCH] 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 --- src/lib/ecore_wl2/Ecore_Wl2.h | 12 ++++++++++++ src/lib/ecore_wl2/ecore_wl2_display.c | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 069ec15..00fe799 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -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 diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index 69838f7..d96405c 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -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); +} -- 2.7.4