dist_installed_ecorewl2mainheaders_DATA = lib/ecore_wl2/Ecore_Wl2.h
lib_ecore_wl2_libecore_wl2_la_SOURCES = \
+lib/ecore_wl2/session-recovery-client-protocol.h \
+lib/ecore_wl2/session-recovery-protocol.c \
lib/ecore_wl2/subsurface-client-protocol.h \
lib/ecore_wl2/subsurface-protocol.c \
lib/ecore_wl2/xdg-shell-client-protocol.h \
EINA_INLIST_FOREACH(ewd->windows, window)
_ecore_wl2_window_www_surface_init(window);
}
+ else if ((!strcmp(interface, "zwp_e_session_recovery")) &&
+ (getenv("EFL_WAYLAND_SESSION_RECOVERY")))
+ {
+ ewd->wl.session_recovery =
+ wl_registry_bind(registry, id,
+ &zwp_e_session_recovery_interface, 1);
+ }
else if (!strcmp(interface, "wl_output"))
_ecore_wl2_output_add(ewd, id);
else if (!strcmp(interface, "wl_seat"))
eina_hash_free(ewd->globals);
+ if (ewd->wl.session_recovery)
+ zwp_e_session_recovery_destroy(ewd->wl.session_recovery);
if (ewd->wl.www) www_destroy(ewd->wl.www);
if (ewd->wl.xdg_shell) xdg_shell_destroy(ewd->wl.xdg_shell);
if (ewd->wl.wl_shell) wl_shell_destroy(ewd->wl.wl_shell);
# define _ECORE_WL2_PRIVATE_H
# include <unistd.h>
+# include <uuid/uuid.h>
# include "Ecore_Wl2.h"
# include "Ecore_Input.h"
# include "www-protocol.h"
# include "xdg-shell-client-protocol.h"
# define XDG_VERSION 5
+# include "session-recovery-client-protocol.h"
+
extern int _ecore_wl2_log_dom;
# ifdef EAPI
struct wl_shell *wl_shell;
struct xdg_shell *xdg_shell;
struct www *www;
+ struct zwp_e_session_recovery *session_recovery;
int compositor_version;
} wl;
struct xdg_popup *xdg_popup;
struct www_surface *www_surface;
+ uuid_t uuid;
+
uint32_t configure_serial;
void (*configure_ack)(struct xdg_surface *surface, uint32_t serial);
#include "ecore_wl2_private.h"
static void
+_session_recovery_uuid(void *data, struct zwp_e_session_recovery *session_recovery, const char *uuid)
+{
+ Ecore_Wl2_Window *win;
+ char str[37];
+
+ win = data;
+ if (!win) return;
+ if (!session_recovery) return;
+ uuid_parse(uuid, win->uuid);
+ uuid_unparse(win->uuid, str);
+ DBG("UUID event received from compositor with UUID: %s\n", str);
+}
+
+static const struct zwp_e_session_recovery_listener _session_listener =
+{
+ _session_recovery_uuid,
+};
+
+static void
_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges, Eina_Bool fs, Eina_Bool max)
{
Ecore_Wl2_Event_Window_Configure *ev;
window->surface_id =
wl_proxy_get_id((struct wl_proxy *)window->surface);
+
+ if ((window->display->wl.session_recovery) &&
+ (getenv("EFL_WAYLAND_SESSION_RECOVERY")))
+ {
+ char uuid[37];
+
+ zwp_e_session_recovery_add_listener(window->display->wl.session_recovery,
+ &_session_listener, window);
+ if (!uuid_is_null(window->uuid))
+ {
+ uuid_unparse(window->uuid, uuid);
+ zwp_e_session_recovery_provide_uuid(window->display->wl.session_recovery, uuid);
+ }
+ }
}
return window->surface;
--- /dev/null
+#ifndef E_SESSION_RECOVERY_CLIENT_PROTOCOL_H
+#define E_SESSION_RECOVERY_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct zwp_e_session_recovery;
+
+extern const struct wl_interface zwp_e_session_recovery_interface;
+
+struct zwp_e_session_recovery_listener {
+ /**
+ * uuid - (none)
+ * @uuid: (none)
+ */
+ void (*uuid)(void *data,
+ struct zwp_e_session_recovery *zwp_e_session_recovery,
+ const char *uuid);
+};
+
+static inline int
+zwp_e_session_recovery_add_listener(struct zwp_e_session_recovery *zwp_e_session_recovery,
+ const struct zwp_e_session_recovery_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) zwp_e_session_recovery,
+ (void (**)(void)) listener, data);
+}
+
+#define ZWP_E_SESSION_RECOVERY_PROVIDE_UUID 0
+
+static inline void
+zwp_e_session_recovery_set_user_data(struct zwp_e_session_recovery *zwp_e_session_recovery, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) zwp_e_session_recovery, user_data);
+}
+
+static inline void *
+zwp_e_session_recovery_get_user_data(struct zwp_e_session_recovery *zwp_e_session_recovery)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) zwp_e_session_recovery);
+}
+
+static inline void
+zwp_e_session_recovery_destroy(struct zwp_e_session_recovery *zwp_e_session_recovery)
+{
+ wl_proxy_destroy((struct wl_proxy *) zwp_e_session_recovery);
+}
+
+static inline void
+zwp_e_session_recovery_provide_uuid(struct zwp_e_session_recovery *zwp_e_session_recovery, const char *uuid)
+{
+ wl_proxy_marshal((struct wl_proxy *) zwp_e_session_recovery,
+ ZWP_E_SESSION_RECOVERY_PROVIDE_UUID, uuid);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+
+static const struct wl_interface *types[] = {
+ NULL,
+};
+
+static const struct wl_message zwp_e_session_recovery_requests[] = {
+ { "provide_uuid", "s", types + 0 },
+};
+
+static const struct wl_message zwp_e_session_recovery_events[] = {
+ { "uuid", "s", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface zwp_e_session_recovery_interface = {
+ "zwp_e_session_recovery", 1,
+ 1, zwp_e_session_recovery_requests,
+ 1, zwp_e_session_recovery_events,
+};
+