ecore_wl2: Add new API to latch window state for updates
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 4 Oct 2017 18:46:34 +0000 (13:46 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Thu, 12 Oct 2017 17:24:03 +0000 (12:24 -0500)
Add an API to call at the beginning of render to latch state at
that moment, and use it for the wayland engine.

src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_private.h
src/lib/ecore_wl2/ecore_wl2_window.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index 288ffda..70edf4d 100644 (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
index 743c05b..ff78a82 100644 (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
index ed9732d..9b22319 100644 (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;
+}
index e2e6cec..4d32bfa 100644 (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,