kitty/glfw
ttyS3 98366076e1
fix(wayland): detect start_drag silently ignored by the compositor
The pointer_button_count check added in dc36e2165 uses the client side
view of the implicit grab, which is stale when the button release is
still in flight: glfwStartDrag passes the check, but by the time the
compositor processes wl_data_device.start_drag the implicit grab is
gone and the request is silently dropped. The data source then never
receives any event, so the tab drag state leaks forever, hijacking
mouse handling again, and the already created xdg_toplevel_drag
toplevel gets mapped as a stray undecorated window showing the drag
thumbnail that nothing ever destroys.

Detect this deterministically using protocol ordering: issue a
wl_display.sync right after start_drag. An accepted start_drag
synchronously produces events (wl_pointer.leave from the DND grab
taking over, wl_data_device.enter, wl_data_source events) that are
ordered before the sync callback. If the callback fires with none of
them seen, the request was dropped: cancel the drag, which notifies
the application (clearing the tab drag state) and destroys the drag
toplevel and data source.

Also defer mapping the drag toplevel until the session is confirmed,
so the stray window can never appear, not even for one frame.

Verified against headless GNOME Shell 50.2 (mutter) with injected
pointer timing scans: the unpatched build deadlocks with an orphaned
drag toplevel within ~13 fast flicks, the patched build catches every
race hit and cancels cleanly, with no deadlock, no stray window, and
normal slow drag/reorder/detach behaviour preserved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-12 14:16:22 +08:00
..
__init__.py
backend_utils.c Refactor drop API and implement it on Wayland 2026-02-08 22:05:14 +05:30
backend_utils.h DRYer 2026-02-07 23:11:42 +05:30
cocoa_displaylink.m Nano-optimisation: Avoid using a block with GCD 2025-10-22 13:40:42 +05:30
cocoa_init.m Add debug logging for NSDraggingSession 2026-05-14 08:16:03 +05:30
cocoa_joystick.h
cocoa_joystick.m
cocoa_monitor.m Add some missing assertions 2025-08-16 07:38:54 +05:30
cocoa_platform.h Rewrite macOS drop handling code to workaround Apple's insanely limited API 2026-05-16 13:06:23 +05:30
cocoa_window.m Fix #10054 2026-05-22 07:57:41 +05:30
context.c
dbus_glfw.c
dbus_glfw.h
egl_context.c Fallback to eglGetDisplay() when eglGetPlatformDisplayEXT() returns EGL_NO_DISPLAY 2025-08-16 08:13:40 +05:30
egl_context.h
glfw.py macos: explicitly enable modern window corners on macOS 26 2026-04-18 20:41:38 +08:00
glfw3.h Properly pass source actions to drop events 2026-05-14 11:07:52 +05:30
glx_context.c Add some missing assertions 2025-08-16 07:38:54 +05:30
glx_context.h
ibus_glfw.c Fix multiple security vulnerabilities across C, Python, and Go code 2026-04-03 16:10:46 +01:00
ibus_glfw.h
init.c
input.c glfw/input.c: fix dedup to swap duplicates to end instead of overwriting pointers 2026-05-19 02:12:29 +00:00
internal.h Properly pass source actions to drop events 2026-05-14 11:07:52 +05:30
kwin-blur-v1.xml
linux_desktop_settings.c ... 2025-11-22 20:03:01 +05:30
linux_desktop_settings.h
linux_joystick.c
linux_joystick.h
linux_notify.c
linux_notify.h
main_loop.h
mappings.h
memfd.h
momentum-scroll.c Fix #9904 2026-04-22 07:43:57 +05:30
monitor.c
monotonic.c
nsgl_context.h
nsgl_context.m Cleanup previous PR 2026-02-23 07:44:58 +05:30
null_init.c
null_joystick.c
null_joystick.h
null_monitor.c
null_platform.h
null_window.c More work on DnD kitten 2026-05-13 08:25:14 +05:30
osmesa_context.c Add some missing assertions 2025-08-16 07:38:54 +05:30
osmesa_context.h
posix_thread.c
posix_thread.h
source-info.json Wayland: Allow holding momentum scroll by putting two finger on touchpad. Fixes #9863 2026-04-14 09:39:57 +05:30
vulkan.c
window.c Fix spurious mouse release event during drag out of OS window 2026-03-26 14:00:57 +00:00
wl_client_side_decorations.c Support hide_window_decorations titlebar-only on Wayland 2026-02-08 19:49:44 +01:00
wl_client_side_decorations.h Wayland: Fix incorrect window size calculation when transitioning from fullscreen to non-fullscreen with client side decorations 2025-07-17 20:36:38 +05:30
wl_cursors.c
wl_cursors.h
wl_init.c fix(wayland): detect start_drag silently ignored by the compositor 2026-06-12 14:16:22 +08:00
wl_monitor.c Add some missing assertions 2025-08-16 07:38:54 +05:30
wl_platform.h fix(wayland): detect start_drag silently ignored by the compositor 2026-06-12 14:16:22 +08:00
wl_text_input.c
wl_text_input.h
wl_window.c fix(wayland): detect start_drag silently ignored by the compositor 2026-06-12 14:16:22 +08:00
wlr-layer-shell-unstable-v1.xml
x11_init.c Implement source_actions for X11 and cocoa DnD backends 2026-05-14 05:46:21 +00:00
x11_monitor.c Add some missing assertions 2025-08-16 07:38:54 +05:30
x11_platform.h Implement source_actions for X11 and cocoa DnD backends 2026-05-14 05:46:21 +00:00
x11_window.c Fix #10082: Re-apply _NET_WM_STATE for X11 layer shell windows on each show 2026-05-28 02:07:59 +00:00
xkb-compat-shim.h
xkb_glfw.c Linux: Rather than crashing on systems that give us broken keymaps just ignore key events 2026-01-30 19:00:46 +05:30
xkb_glfw.h