Skip to content

wayland: Handle drop event data reads asynchronously - #16532

Merged
Kontrabant merged 1 commit into
libsdl-org:mainfrom
Kontrabant:wl_async_cb
Oct 20, 2026
Merged

Kontrabant merged 1 commit into
libsdl-org:mainfrom
Kontrabant:wl_async_cb

Conversation

@Kontrabant

Copy link
Copy Markdown
Contributor

Previously, drop events had a hard timeout value of 14ms to prevent blocking the main event loop for too long while reading remote data. This timeout could be too short in some cases, leading to failed drop events, so the timeout has been increased, and drop events read the remote data asynchronously to prevent blocking the main event loop for excessive periods.

Fixes #16521
Closes #16406

  • I confirm that I am the author of this code and release it to the SDL project under the zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

@Kontrabant
Kontrabant marked this pull request as draft October 16, 2026 16:45
@Kontrabant

Copy link
Copy Markdown
Contributor Author

Hmm, there is a rare case where this could still block and/or deadlock due to queues holding the global Wayland display lock when dispatching. Need to rework this.

@Kontrabant
Kontrabant marked this pull request as ready for review October 18, 2026 15:57
@Kontrabant
Kontrabant force-pushed the wl_async_cb branch 10 times, most recently from 4c7e8fd to fb228f6 Compare October 19, 2026 23:55
Previously, drop events had a hard timeout value of 14ms to prevent blocking the main event loop for too long while reading remote data. This timeout could be too short in some cases, leading to failed drop events, so the timeout has been increased, and drop events read the remote data asynchronously to prevent blocking the main event loop for excessive periods.
@Kontrabant

Copy link
Copy Markdown
Contributor Author

Ok, reworked, tested, re-tested, and finally ready to go. No blocking under normal operation, and no deadlocks.

@Kontrabant
Kontrabant merged commit d0183f0 into libsdl-org:main Oct 20, 2026
10 checks passed
@Kontrabant
Kontrabant deleted the wl_async_cb branch October 20, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Wayland] File drops from GTK4 sources never produce SDL_EVENT_DROP_FILE: text/plain MIME overrides text/uri-list, and DnD receive uses a 14 ms timeout

2 participants