ValveSoftware / gamescope

SteamOS session compositing window manager
Other
2.99k stars 198 forks source link

Borderless fullscreen support #911

Open orowith2os opened 1 year ago

orowith2os commented 1 year ago

Essentially a dupe (and revival) of https://github.com/ValveSoftware/gamescope/issues/109

Gamescope currently has three window types:

It would make life better for me, and probably many others, to have a "Fullscreen borderless window" option, with many having multiple monitors and wanting to use gamescope in fullscreen without it minimizing on focus loss.

orowith2os commented 1 year ago

Turns out GNOME has this - it's just not exposed in the super+right click menu by default, and only as an unbound shortcut. You can force fullscreen any window you want. I'm not sure if gamescope needs to do anything else here, or if it can do anything here. Is it possible for gamescope to not unfocus when running maximized and focus is lost?

Joshua-Ashton commented 1 year ago

Gamescope already has this, Win + F... --fullscreen is also borderless.

If it is not then something is wrong but it works on my machine on KDE and LabWC.

orowith2os commented 1 year ago

I recall gamescope consistently minimizing when it loses focus on my system (GNOME), even with fullscreen. Only borderless and windowed don't minimize.

I'm rebuilding gamescope to see if I can reproduce it on my laptop.

Devorlon commented 1 year ago

I've tried to reproduce the issue and here's how gamescope acts with the different window options on my system. I've got package versions at the bottom. Throughout this I will be referring to terms such as Windowed, Borderless and Fullscreen in various combinations. For a fuller understanding of what these mean please refer to the PCGaminkWiki's article: link

Windowed Bordered | gamescope (default)

A window like any other GUI program with a border (decorations). Can be minimised

https://github.com/ValveSoftware/gamescope/assets/19249443/f726afaa-632c-47b5-97e7-5308261ba0f4

Output ``` [devorlon@test ~]$ gamescope -- glxgears No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected. wlserver: [backend/headless/backend.c:68] Creating headless backend vulkan: selecting physical device 'AMD Radeon RX 6800 XT (RADV NAVI21)': queue family 1 vulkan: physical device supports DRM format modifiers vulkan: supported DRM formats for sampling usage: vulkan: AR24 (0x34325241) vulkan: XR24 (0x34325258) vulkan: AB24 (0x34324241) vulkan: XB24 (0x34324258) vulkan: NV12 (0x3231564E) vulkan: AB4H (0x48344241) vulkan: XB4H (0x48344258) vulkan: AB48 (0x38344241) vulkan: XB48 (0x38344258) vulkan: AB30 (0x30334241) vulkan: XB30 (0x30334258) vulkan: AR30 (0x30335241) vulkan: XR30 (0x30335258) wlserver: Running compositor on wayland display 'gamescope-0' wlserver: [backend/headless/backend.c:16] Starting headless backend wlserver: [xwayland/sockets.c:63] Failed to bind socket @/tmp/.X11-unix/X2: Address already in use wlserver: [xwayland/server.c:108] Starting Xwayland on :5 wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x55d030163a90 (res 0x55d0301664a0) wlserver: [xwayland/server.c:273] Xserver is ready pipewire: stream state changed: connecting pipewire: stream state changed: paused pipewire: stream available on node ID: 95 pipewire: renegotiating stream params (size: 1280x720) wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x55d0300bda20 (res 0x55d03016d150) xwm: got the same buffer committed twice, ignoring. The XKEYBOARD keymap compiler (xkbcomp) reports: Warning: Unsupported maximum keycode 708, clipping. X11 cannot support keycodes above 255. Errors from xkbcomp are not fatal to the X server Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. pipewire: renegotiating stream params (size: 2560x1371) 819 frames in 5.0 seconds = 163.693 FPS pipewire: renegotiating stream params (size: 1280x720) pipewire: renegotiating stream params (size: 385x1371) 738 frames in 5.0 seconds = 147.444 FPS 742 frames in 5.0 seconds = 148.385 FPS 826 frames in 5.0 seconds = 164.998 FPS 825 frames in 5.0 seconds = 164.999 FPS 825 frames in 5.0 seconds = 164.991 FPS 826 frames in 5.0 seconds = 165.012 FPS 804 frames in 5.0 seconds = 160.605 FPS ^C gamescope: received kill signal, terminating! xwm: Lost connection to the X11 server 0 xwm: X11 I/O error ```

Windowed Borderless | gamescope --borderless or -b

A window without any border. Can be minimised

https://github.com/ValveSoftware/gamescope/assets/19249443/e3baa6fa-baa4-49b9-9dce-0c8e8bfbb871

Output ``` [devorlon@test ~]$ gamescope -b -- glxgears No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected. wlserver: [backend/headless/backend.c:68] Creating headless backend vulkan: selecting physical device 'AMD Radeon RX 6800 XT (RADV NAVI21)': queue family 1 vulkan: physical device supports DRM format modifiers vulkan: supported DRM formats for sampling usage: vulkan: AR24 (0x34325241) vulkan: XR24 (0x34325258) vulkan: AB24 (0x34324241) vulkan: XB24 (0x34324258) vulkan: NV12 (0x3231564E) vulkan: AB4H (0x48344241) vulkan: XB4H (0x48344258) vulkan: AB48 (0x38344241) vulkan: XB48 (0x38344258) vulkan: AB30 (0x30334241) vulkan: XB30 (0x30334258) vulkan: AR30 (0x30335241) vulkan: XR30 (0x30335258) wlserver: Running compositor on wayland display 'gamescope-0' wlserver: [backend/headless/backend.c:16] Starting headless backend wlserver: [xwayland/sockets.c:63] Failed to bind socket @/tmp/.X11-unix/X2: Address already in use wlserver: [xwayland/server.c:108] Starting Xwayland on :5 wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x55d9a22daa90 (res 0x55d9a22dd4a0) wlserver: [xwayland/server.c:273] Xserver is ready pipewire: stream state changed: connecting pipewire: stream state changed: paused pipewire: stream available on node ID: 93 pipewire: renegotiating stream params (size: 1280x720) wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x55d9a2234a20 (res 0x55d9a22e3da0) xwm: got the same buffer committed twice, ignoring. Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. The XKEYBOARD keymap compiler (xkbcomp) reports: Warning: Unsupported maximum keycode 708, clipping. X11 cannot support keycodes above 255. Errors from xkbcomp are not fatal to the X server 812 frames in 5.0 seconds = 162.369 FPS pipewire: renegotiating stream params (size: 2560x1408) pipewire: renegotiating stream params (size: 1280x720) pipewire: renegotiating stream params (size: 385x1408) 667 frames in 5.0 seconds = 133.250 FPS (EE) failed to read Wayland events: Broken pipe [devorlon@test ~]$ X connection to :5 broken (explicit kill or server shutdown). ```

Borderless Fullscreen Windowed | gamescope --fullscreen or -f

A window without any border that is maximised to use the entire screen. Can't be minimised

https://github.com/ValveSoftware/gamescope/assets/19249443/0eaa3eab-1366-4875-bee1-7605bc9602ee

Output ``` [devorlon@test ~]$ gamescope -f -- glxgears No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected. wlserver: [backend/headless/backend.c:68] Creating headless backend vulkan: selecting physical device 'AMD Radeon RX 6800 XT (RADV NAVI21)': queue family 1 vulkan: physical device supports DRM format modifiers vulkan: supported DRM formats for sampling usage: vulkan: AR24 (0x34325241) vulkan: XR24 (0x34325258) vulkan: AB24 (0x34324241) vulkan: XB24 (0x34324258) vulkan: NV12 (0x3231564E) vulkan: AB4H (0x48344241) vulkan: XB4H (0x48344258) vulkan: AB48 (0x38344241) vulkan: XB48 (0x38344258) vulkan: AB30 (0x30334241) vulkan: XB30 (0x30334258) vulkan: AR30 (0x30335241) vulkan: XR30 (0x30335258) wlserver: Running compositor on wayland display 'gamescope-0' wlserver: [backend/headless/backend.c:16] Starting headless backend wlserver: [xwayland/sockets.c:63] Failed to bind socket @/tmp/.X11-unix/X2: Address already in use wlserver: [xwayland/server.c:108] Starting Xwayland on :5 wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x558576bb18e0 (res 0x558576bb43c0) wlserver: [xwayland/server.c:273] Xserver is ready pipewire: stream state changed: connecting pipewire: stream state changed: paused pipewire: stream available on node ID: 68 pipewire: renegotiating stream params (size: 1280x720) wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x558576b0a250 (res 0x558576bbada0) xwm: got the same buffer committed twice, ignoring. Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. The XKEYBOARD keymap compiler (xkbcomp) reports: Warning: Unsupported maximum keycode 708, clipping. X11 cannot support keycodes above 255. Errors from xkbcomp are not fatal to the X server pipewire: renegotiating stream params (size: 2560x1440) 821 frames in 5.0 seconds = 164.008 FPS ^C gamescope: received kill signal, terminating! xwm: X11 I/O error ```

I don't think gamescope will ever minimise itself on focus loss unless you have something interfearing with that. Since you use gnome I'd recommend checking out any extensions you might have.

Specs / Versions ``` OS: Arch Linux [2023-09-09T16:53:08+0100] gamescope: 3.12.5 Gnome: 44.4 Kernel: 6.4.12-arch mesa-utils: 9.0.0 ```
ashleysommer commented 9 months ago

I had this same issue as described by @orowith2os, using Nobora linux (based on Fedora 38) and Gnome 45. When launching with -f the window tried to fullscreen but it still had a title bar and window controls. Issue #985 is also a duplicate of this, so it is affecting others too.

I did some pretty extensive digging, looking at how gamescope uses SDL2 to configure a child window, it uses SDL_WINDOW_FULLSCREEN_DESKTOP mode, that should be a borderless fullscreen mode, and indeed that used to work on Gnome on earlier versions of Gnome and earlier versions of SDL2.

I tracked the problem down to SDL2's use of libdecor in newer versions of SDL2 on Gnome. Mutter Wayland does indeed have a true fullscreen mode that windows can run in, but looking through the mutter code, there are only two codepaths that trigger windows to enter true fullscreen. First is the global shortcut, (disabled by default) configurable through the Gnome settings panel, you can set eg. ctrl+alt+shift+f to force the mutter wayland compositor to enable true fullscreen mode (and bonus, unredirect compositing) on that window. The second code path is through xdg-shell (specifically, xdg_toplevel_set_fullscreen()). So wayland client apps can use the xdg-shell protocol to set their client window to true fullscreen that way.

SDL2 has supported xdg-shell for a long time, and it does work correctly, the problem is newer versions of SDL2 detect the presence of libdecor on the system, and supported by the compositor (mutter), so it uses libdecor to set up the wayland window, instead of xdg-shell. The use of the combination of SDL_WINDOW_FULLSCREEN_DESKTOP mode, along with libdecor cause the window to be drawn maximised with client-side title-bar and window controls. That's not what we want.

I don't know if that should be fixed in SDL2, or in libdecor, but in any case, I can work around it in Gamescope with the very helpful libdecor killswitch: env SDL_VIDEO_WAYLAND_PREFER_LIBDECOR=0 gamescope -f -- glxgears. Now it works exactly as expected, and same as it does on KDE Plasma.

AlexFolland commented 7 months ago

Borderless Fullscreen Windowed | gamescope --fullscreen or -f

A window without any border that is maximised to use the entire screen. Can't be minimised

I tried this in XFCE with Nvidia 545 with specifically command line gamescope -f -- vkgears and I was able to minimize the window by using my window-switching bind (alt-tab) to switch away from it and using the usual panel task button's "Minimize" right-click context menu entry. The only thing that I can normally do that I couldn't do with this window is move it around and resize it with my usual XFWM Super+LMB and Super+RMB binds respectively. Other windows can go on top of it and it can be minimized here, so it's almost as good as a full borderless fullscreen windowed mode, at least in XFWM.