WaylandBackend: paste the host clipboard into nested XWayland - #2277
Open
craimasjien wants to merge 5 commits into
Open
WaylandBackend: paste the host clipboard into nested XWayland#2277craimasjien wants to merge 5 commits into
craimasjien wants to merge 5 commits into
Conversation
|
Relevant prior work / open PR: #2062 |
|
Fixes: #1935 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
My first attempt adding functionality/contributing to gamescope, bear with me.
This PR adds the missing host → guest clipboard path to the nested Wayland backend, so the host session's clipboard (and primary selection) can be pasted into XWayland apps running inside gamescope. Text only, both CLIPBOARD and PRIMARY.
When gamescope runs nested under a Wayland compositor (KWin/Plasma, etc.), the clipboard bridge is one-directional today:
Very quickly described, I decided to pick up the best applicable MIME type (to also filter out non-text clipboard content), forward that over a pipe until it reads EOF. Maximum clipboard size is set to 4MiB. It's then handed over to
gamescope_set_selectionand thenhandle_selection_requesthands it to the guest.One caveat by design is that the gamescope window will only accept input while the gamescope surface holds the host keyboard focus; meaning that it will only serve the intended loop of: focussing another application on the host machine, selecting text, copying the text, refocussing on the gamescope window, and then pasting it in. So the text selection events only fire when you refocus to gamescope, essentially. What this means is that if you are able to copy content while not losing the gamescope window's focus, it will not be pastable into gamescope.