Fixed getting text from clipboard in Linux #17467
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
It fixes issue #4320
What is the current behavior?
When calling X11Clipboard.GetTextAsync() in Linux (tested on Debian based), the task runs indefinitely (i.e. awaiting or
.Result
makes the current thread wait for an event to be handled, which does not happen)What is the updated/expected behavior with this PR?
It returns the text which is in the clipboard without issue.
How was the solution implemented (if it's not obvious)?
It was implemented by skipping all the generic event handling and just handling the event in
X11Clipboard
itself (by callingX11Clipboard.OnEvent
). The reason for this is that the generic event handling in Avalonia does not catchSelectionEvent
. I could not figure out why. I assume it's some X11 issue not properly working with GLib. Either way, it works with my changes andOnEvent
is still used.Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #4320