summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-08-14 17:44:13 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-08-18 14:27:32 -0500
commit11d3bf7939fa2f2934efd0cf73172a3c6075f3af (patch)
treebcf05ab813d92dfed9843ebeb85c26cfac552825 /src/lib/ecore_wl2
parente3b9fbaed8e5e5f3730d3a8aa406873f8df60744 (diff)
ecore_wl2: Add API ecore_wl2_window_commit()
Abstract wl_surface commits in ecore_wl2_window.
Diffstat (limited to 'src/lib/ecore_wl2')
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h18
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c15
3 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 06e5c84ac7..1a558a2bdb 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -1873,6 +1873,24 @@ EAPI void ecore_wl2_offer_finish(Ecore_Wl2_Offer *offer);
1873 */ 1873 */
1874EAPI void ecore_wl2_session_recovery_disable(void); 1874EAPI void ecore_wl2_session_recovery_disable(void);
1875 1875
1876/**
1877 * Commit the surface of a wayland window.
1878 *
1879 * If flush is set this generates a wl_surface_commit(), otherwise it is
1880 * expected that some other call in the very near future (such as
1881 * eglSwapBuffers) will cause an implicit flush.
1882 *
1883 * A surface that has been commit will be in the "pending" state until
1884 * the compositor tells us it's time to draw again via a frame callback.
1885 *
1886 * @surface surface to commit
1887 * @flush EINA_TRUE if we need to flush immediately.
1888 *
1889 * @since 1.20
1890 */
1891EAPI void ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush);
1892
1893/**
1876# endif 1894# endif
1877 1895
1878# undef EAPI 1896# undef EAPI
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 431d40880e..4ee29752e6 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -155,6 +155,7 @@ struct _Ecore_Wl2_Window
155 const char *role; 155 const char *role;
156 156
157 struct wl_surface *surface; 157 struct wl_surface *surface;
158 struct wl_callback *callback;
158 struct www_surface *www_surface; 159 struct www_surface *www_surface;
159 struct zxdg_surface_v6 *zxdg_surface; 160 struct zxdg_surface_v6 *zxdg_surface;
160 struct zxdg_toplevel_v6 *zxdg_toplevel; 161 struct zxdg_toplevel_v6 *zxdg_toplevel;
@@ -199,6 +200,8 @@ struct _Ecore_Wl2_Window
199 Eina_Bool focus_skip : 1; 200 Eina_Bool focus_skip : 1;
200 Eina_Bool floating : 1; 201 Eina_Bool floating : 1;
201 202
203 Eina_Bool commit_pending : 1;
204
202 struct 205 struct
203 { 206 {
204 Eina_Bool configure : 1; 207 Eina_Bool configure : 1;
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 6ee7af6af8..422b330443 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -535,6 +535,7 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
535 { 535 {
536 wl_surface_attach(window->surface, NULL, 0, 0); 536 wl_surface_attach(window->surface, NULL, 0, 0);
537 wl_surface_commit(window->surface); 537 wl_surface_commit(window->surface);
538 window->commit_pending = EINA_FALSE;
538 } 539 }
539 540
540 window->configure_serial = 0; 541 window->configure_serial = 0;
@@ -1342,3 +1343,17 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int
1342 if (window->display->wl.efl_hints && window->zxdg_toplevel) 1343 if (window->display->wl.efl_hints && window->zxdg_toplevel)
1343 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, w, h, aspect); 1344 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, w, h, aspect);
1344} 1345}
1346
1347EAPI void ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush)
1348{
1349 EINA_SAFETY_ON_NULL_RETURN(window);
1350 EINA_SAFETY_ON_NULL_RETURN(window->surface);
1351
1352 if (window->commit_pending) ERR("Commit before previous commit processed");
1353
1354 window->commit_pending = EINA_TRUE;
1355 window->callback = wl_surface_frame(window->surface);
1356 wl_callback_add_listener(window->callback, &_frame_listener, window);
1357
1358 if (flush) wl_surface_commit(window->surface);
1359}