summaryrefslogtreecommitdiff
path: root/src/platform/wayland/internal.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 23:52:22 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 23:52:22 +0300
commit563b23a33726289387193b85d90fb569631ee05f (patch)
treeddf438338034b5ab2690b531684906999e56df44 /src/platform/wayland/internal.h
parent76073fe5fad8799e5850805f2f090af2cb62c741 (diff)
Reconnect to a restarted Wayland compositor
Windows now outlive the compositor. On connection loss YASL sends DISPLAY_LOST instead of closing every window, retries the connection on a loop timer, rebuilds each toplevel with its title, size, state and GL context, and sends DISPLAY_RESTORED. CPU windows keep their pixels; GPU renderers drop Vulkan surfaces and GL objects on loss and rebuild them on restore. - Free the dead connection's objects on the next wait, after the application has released GPU objects built on them. - Report a lost connection as an event rather than a failed wait. - Refuse window and Vulkan surface creation while offline with the new YASL_ERROR_DISCONNECTED. - Close popups, cancel drags and fail pending clipboard requests on loss. - Print only protocol errors, not ordinary disconnects. - Examples survive a restart; game.c rebinds its GL context. - Add an end-to-end test that kills Weston under CPU, GL and Vulkan windows and requires them to recover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/platform/wayland/internal.h')
-rw-r--r--src/platform/wayland/internal.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/platform/wayland/internal.h b/src/platform/wayland/internal.h
index a479e2b..92108c1 100644
--- a/src/platform/wayland/internal.h
+++ b/src/platform/wayland/internal.h
@@ -251,6 +251,10 @@ struct wayland_display {
struct conn_drag drag;
struct wayland_surface *surfaces;
struct wayland_surface *dead;
+ /* While lost: retries a connection; stale marks objects of the dead one. */
+ yasl_private_timer_id reconnect_timer;
+ uint64_t reconnect_delay_ns;
+ bool stale;
/* 4-byte integers */
int cursor_size;
@@ -287,7 +291,12 @@ struct wayland_surface {
EGLSurface egl_surface;
EGLContext egl_context;
EGLConfig egl_config;
+ struct yasl_private_gl_options gl_options;
+ struct wayland_surface *gl_share;
+ bool gl_built;
#endif
+ char *title;
+ bool tearing;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *toplevel;
struct xdg_popup *popup;
@@ -393,6 +402,12 @@ void surface_draw_frame(struct wayland_surface *w);
void wayland_surface_arm_frame(struct wayland_surface *w);
void surface_fail(struct wayland_surface *w);
void display_leave(struct wayland_display *c);
+/* Native objects of a toplevel: built at creation and again after a reconnect. */
+int surface_build_toplevel(struct wayland_surface *w, bool fullscreen);
+void surface_release_native(struct wayland_surface *w);
+#if YASL_HAS_EGL
+bool surface_build_gl(struct wayland_surface *w);
+#endif
static inline struct wayland_surface *surface_root(struct wayland_surface *w)
{