gamescope icon indicating copy to clipboard operation
gamescope copied to clipboard

[Feature request] Support for Wayland clients

Open TheComputerGuy96 opened this issue 3 years ago • 7 comments
trafficstars

As the title says, Gamescope needs to add support for Wayland clients

For example If you try to run a SDL2 game with SDL_VIDEODRIVER=wayland under gamescope, then gamescope won't touch it at all

Running it with SDL_VIDEODRIVER=x11 makes gamescope actually work with it, but I don't like running an outdated display server if a game can natively run on Wayland

I wonder how hard this would be to achieve because you use wlroots (I've tried running nested sway with the output scale set to below 1 for one of gamescope's nice features (aka downsampling) and it kinda works but it's a bit of a mess with having to resize a microscopic terminal and the mouse spins in circles in the few games I tried)

Edit: Apparently this topic was mentioned in #164, but it wasn't a feature request

TheComputerGuy96 avatar Jul 05 '22 16:07 TheComputerGuy96

This sort of thing is why you couldn't run OBS Studio in game mode by default. It is detected as a Wayland session, but the fact that Gamescope doesn't actually support Wayland clients causes it to just immediately crash.

Either gamescope should support Wayland clients, or it should not advertise itself as a Wayland session.

EDIT: As to the OP's concerns, it is worth noting that you're not actually running Xorg when you set SDL_VIDEODRIVER=x11. All applications go through XWayland. But then I have to wonder... why do any of the applications with backends that support Wayland work at all right now, if Gamescope is detected as Wayland without actually supporting Wayland clients?

TiZ-HugLife avatar Jul 11 '22 16:07 TiZ-HugLife

We do not advertise support for xdg shell.

misyltoad avatar Jul 11 '22 17:07 misyltoad

I'm presuming XDG Shell is what most other applications check to determine if they are running in a Wayland compositor. Then, in that case, do you think that Qt 6--the toolkit that OBS Studio is using--is doing something wrong?

TiZ-HugLife avatar Jul 11 '22 20:07 TiZ-HugLife

Yes, Qt6 should check if xdg-shell is supported before trying to use it, and fallback to X if not.

misyltoad avatar Jul 11 '22 20:07 misyltoad

We don't have this problem with other Qt apps though, so, strange... maybe its something OBS is doing instead? Have we determined its Qt and not say, wayland video capture plugin, etc?

misyltoad avatar Jul 11 '22 20:07 misyltoad

Potentially? It seems like OBS team is also unsure whether it's them or Qt. I'm pretty sure "Wayland video capture" is just Pipewire--and as far as I know, Pipewire-based video capture should also work on X11 anyways--but it doesn't, not on KDE Neon nor on SteamOS.

TiZ-HugLife avatar Jul 11 '22 20:07 TiZ-HugLife

Dragging in a loose end from #668: Whenever Wayland clients are fully supported, that should include support for text-input-v3 so that the on-screen keyboard can continue to work, as it now does with SDL's x11 driver:

https://github.com/libsdl-org/SDL/commit/c4b9f621649d4e2ddb05e7f396e43e2d9e0402cc

(FWIW, SDL supports systems without xdg-shell, it just happens to be that xdg-shell gives us a lot of useful stuff, but gamescope won't care about most of this. I encourage anyone focused on this task to look at SDL's Wayland folder to evaluate the tradeoffs: https://github.com/libsdl-org/SDL/tree/main/src/video/wayland )

flibitijibibo avatar Nov 14 '22 16:11 flibitijibibo

I also recently found a use case for supporting Wayland clients.

I've been tinkering with Wine patched with Wayland support, and GNOME freaks out when some games are running with it, showing the window in a weird way.

https://github.com/orowith2os/wine/issues/1#issuecomment-1324458248

orowith2os avatar Nov 23 '22 02:11 orowith2os

Support for xdg-shell was added: https://github.com/ValveSoftware/gamescope/pull/759

eszlari avatar Apr 13 '23 15:04 eszlari

Qt6 applications don't appear to work correctly with --expose-wayland. I've tested both waycheck and zapzap, and both display the same behavior - window decorations aren't hidden, and input fails to register properly. Current release version doesn't allow input at all, just toggles between focused and unfocused on keypress. Current master is an improvement - button presses do seem to do something - but still entirely unusable.

serebit avatar Oct 17 '23 00:10 serebit