From 7e8bf8d2a81f37303e0c9ae430f1acbff106da22 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Wed, 14 Oct 2026 14:16:42 +0300 Subject: Wayland: fix GL thread races, reconnect ordering and sizing bugs - GL swaps on a rendering thread no longer touch frame callbacks or presentation feedback. They set a per-surface flag and wake the loop; the owner thread arms both at its next flush and commits, so the frame callback fires without waiting for the application's next swap. - Clear the offline flag only after the reconnect rebuild succeeds, and not when the connection was lost again during it. - make_current fails with ENOTCONN for a window without a context. Detaching is a no-op when nothing is current or the EGL display is gone. - Window move, resize, window menu and drag start need a pointer button or tablet tip that is still held; otherwise they fail with ESTALE and use that press's serial. Popups fail with ESTALE without an input serial and with ENOTCONN while the display is lost. - An oversized device size shrinks to the buffer limits, keeping the aspect ratio, instead of closing the window. - FIXED_SIZE windows pin xdg min and max on every set_size. The 64px minimum applies only to compositor-suggested sizes, not to application sizes. - The keyboard-enter serial becomes the input serial. Clipboard copy with no keyboard focus fails with ESTALE. - Relative-pointer windows relock after a reconnect rebuild. - errno: EBUSY for an active drag, ENOTSUP for place_under_pointer and for GL without EGL, EINVAL for drag carry without a drag. - Default window title and app ID are "YASL". - Pointer motion and button events carry unrounded device-pixel positions in precise_x/precise_y with precise_position set. Co-Authored-By: Claude Haiku 5.5 --- src/platform/wayland/popup.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/platform/wayland/popup.c') diff --git a/src/platform/wayland/popup.c b/src/platform/wayland/popup.c index 1ae4805..f66e155 100644 --- a/src/platform/wayland/popup.c +++ b/src/platform/wayland/popup.c @@ -136,9 +136,18 @@ struct wayland_surface *wayland_surface_create_popup(struct wayland_surface *par { struct wayland_display *c = parent ? parent->conn : NULL; struct seat *seat = c ? (c->active_seat ? c->active_seat : c->seats) : NULL; - if (!c || c->lost || parent->closed || !parent->xdg_surface || !seat || - !seat->input_serial || !popup_spec_valid(parent, spec)) + if (!c || !parent->xdg_surface || parent->closed || !popup_spec_valid(parent, spec)) { + errno = EINVAL; return NULL; + } + if (c->lost) { + errno = ENOTCONN; + return NULL; + } + if (!seat || !seat->input_serial) { + errno = ESTALE; + return NULL; + } struct wayland_surface *w = calloc(1, sizeof(*w)); if (!w) -- cgit v1.2.3