ecore_wayland: add listener for uuid and provide already existing one
authorStefan Schmidt <stefan@osg.samsung.com>
Mon, 7 Dec 2015 23:08:20 +0000 (00:08 +0100)
committerStefan Schmidt <stefan@osg.samsung.com>
Wed, 16 Dec 2015 21:18:08 +0000 (22:18 +0100)
Setup a listener to receive an uid from the compositor. If we already have
one during creation, aka we are re-connecting to recover a session, we provide
it to the compositor so it can look our attributes up based on it. Again hidden
behind and env var to avoid problems with other developments, for now.

ref T2922

src/lib/ecore_wayland/ecore_wl_window.c

index 1def7ab..44a3ef4 100644 (file)
@@ -395,11 +395,22 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
 
+   char uuid[37];
+
    if (win->surface) return win->surface;
-   if (_ecore_wl_disp->wl.session_recovery && getenv("EFL_WAYLAND_SESSION_RECOVERY"))
-     session_recovery_add_listener(_ecore_wl_disp->wl.session_recovery, &_ecore_session_recovery_listener, win);
    win->surface = wl_compositor_create_surface(_ecore_wl_compositor_get());
    if (!win->surface) return NULL;
+
+   if (_ecore_wl_disp->wl.session_recovery && getenv("EFL_WAYLAND_SESSION_RECOVERY"))
+     {
+        session_recovery_add_listener(_ecore_wl_disp->wl.session_recovery,
+                                      &_ecore_session_recovery_listener, win);
+        if (!uuid_is_null(win->uuid))
+          {
+             uuid_unparse(win->uuid, uuid);
+             session_recovery_provide_uuid(_ecore_wl_disp->wl.session_recovery, uuid);
+          }
+     }
    win->surface_id = wl_proxy_get_id((struct wl_proxy *)win->surface);
    return win->surface;
 }