Skip to content

WaylandBackend: paste the host clipboard into nested XWayland - #2277

Open
craimasjien wants to merge 5 commits into
ValveSoftware:masterfrom
craimasjien:clipboard-host-to-guest-paste
Open

WaylandBackend: paste the host clipboard into nested XWayland#2277
craimasjien wants to merge 5 commits into
ValveSoftware:masterfrom
craimasjien:clipboard-host-to-guest-paste

Conversation

@craimasjien

Copy link
Copy Markdown

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_selection and then handle_selection_request hands 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.

@KogasaPls

Copy link
Copy Markdown

Relevant prior work / open PR: #2062

@WhyNotHugo

Copy link
Copy Markdown

Fixes: #1935

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.

3 participants