ecore-wl2: Add event to raise when window configure is completed.
authorChris Michael <cp.michael@samsung.com>
Wed, 11 Jan 2017 17:22:01 +0000 (12:22 -0500)
committerChris Michael <cp.michael@samsung.com>
Wed, 11 Jan 2017 17:36:33 +0000 (12:36 -0500)
Small patch to create and raise a new event letting ecore_evas know
when the window has been configured. With the addition of xdg_shell v6
support, we cannot commit a surface with an existing buffer until the
surface has been configured. This patch allows us to raise an event to
ecore_evas when the surface has been configured, so we can then attach
a buffer to it.

ref T5090

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2.c
src/lib/ecore_wl2/ecore_wl2_window.c

index 6a0ff4f..58f3e33 100644 (file)
@@ -201,6 +201,11 @@ typedef struct _Ecore_Wl2_Event_Window_Configure
    unsigned int states;
 } Ecore_Wl2_Event_Window_Configure;
 
+typedef struct _Ecore_Wl2_Event_Window_Configure_Complete
+{
+   unsigned int win;
+} Ecore_Wl2_Event_Window_Configure_Complete;
+
 typedef struct _Ecore_Wl2_Event_Sync_Done
 {
    Ecore_Wl2_Display *display;
@@ -250,6 +255,7 @@ EAPI extern int ECORE_WL2_EVENT_SEAT_NAME_CHANGED; /** @since 1.19 */
 EAPI extern int ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED; /** @since 1.19 */
 EAPI extern int ECORE_WL2_EVENT_DEVICE_ADDED; /** @since 1.19 */
 EAPI extern int ECORE_WL2_EVENT_DEVICE_REMOVED; /** @since 1.19 */
+EAPI extern int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE; /** @since 1.19 */
 
 /**
  * @file
index bbae13f..362ef38 100644 (file)
@@ -35,6 +35,7 @@ EAPI int ECORE_WL2_EVENT_SEAT_NAME_CHANGED = 0;
 EAPI int ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED = 0;
 EAPI int ECORE_WL2_EVENT_DEVICE_ADDED = 0;
 EAPI int ECORE_WL2_EVENT_DEVICE_REMOVED = 0;
+EAPI int ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = 0;
 
 EAPI int _ecore_wl2_event_window_www = -1;
 EAPI int _ecore_wl2_event_window_www_drag = -1;
@@ -99,6 +100,7 @@ ecore_wl2_init(void)
         ECORE_WL2_EVENT_DEVICE_REMOVED = ecore_event_type_new();
         _ecore_wl2_event_window_www = ecore_event_type_new();
         _ecore_wl2_event_window_www_drag = ecore_event_type_new();
+        ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = ecore_event_type_new();
      }
    if (!no_session_recovery)
      no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
@@ -152,6 +154,7 @@ ecore_wl2_shutdown(void)
    ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED = 0;
    ECORE_WL2_EVENT_DEVICE_ADDED = 0;
    ECORE_WL2_EVENT_DEVICE_REMOVED = 0;
+   ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE = 0;
 
    /* shutdown Ecore_Event */
    ecore_event_shutdown();
index 6b86be9..91c1e64 100644 (file)
@@ -190,11 +190,19 @@ static void
 _zxdg_surface_cb_configure(void *data, struct zxdg_surface_v6 *zxdg_surface, uint32_t serial)
 {
    Ecore_Wl2_Window *window;
+   Ecore_Wl2_Event_Window_Configure_Complete *ev;
 
    zxdg_surface_v6_ack_configure(zxdg_surface, serial);
 
    window = data;
+   if (!window->pending.configure) return;
    window->pending.configure = EINA_FALSE;
+
+   ev = calloc(1, sizeof(Ecore_Wl2_Event_Window_Configure_Complete));
+   if (!ev) return;
+
+   ev->win = window->id;
+   ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, ev, NULL, NULL);
 }
 
 static const struct zxdg_surface_v6_listener _zxdg_surface_listener =