gamescope icon indicating copy to clipboard operation
gamescope copied to clipboard

Unable to type uppercase letters in Wayland clients

Open effectsbot opened this issue 10 months ago • 12 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Are you using any gamescope patches or a forked version of gamescope?

  • [x] The issue occurs on upstream gamescope without any modifications

Current Behavior

I am unable to type uppercase letters in any wayland-native application inside of gamescope. I first discovered this issue while playing Terraria (with SDL_VIDEODRIVER=wayland set as an environment variable). I've tested this with Alacritty as well and the issue was still there.

Steps To Reproduce

  1. Run gamescope --expose-wayland -- alacritty.
  2. Try typing any uppercase letters in the nested Alacritty window.

Hardware information

- Distro: Arch Linux
- CPU: 6-core AMD Ryzen 5 7500F
- GPU: Advanced Micro Devices [AMD/ATI] Navi 23 [Radeon RX 6650 XT / 6700S 6800S]
- Driver Version: Mesa 24.3.4-arch1.1

Software information

- Desktop environment: Hyprland 0.47.2-1
- Session type: Wayland
- Gamescope version: 3.16.1 (gcc 14.2.1)
- Gamescope launch command(s): gamescope --expose-wayland -- alacritty

Which gamescope backends have the issue you are reporting?

  • [x] Wayland (default for nested gamescope)
  • [ ] DRM (default for embedded gamescope, i.e. gamescope-session)
  • [ ] SDL
  • [ ] OpenVR

Logging, screenshots, or anything else

[gamescope] [Info]  console: gamescope version 3.16.1 (gcc 14.2.1)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts/00-gamescope'
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts/00-gamescope/common'
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/common/inspect.lua' (id: 0)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/common/modegen.lua' (id: 1)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/common/util.lua' (id: 2)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/usr/share/gamescope/scripts/00-gamescope/displays'
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/asus.rogally.lcd.lua' (id: 3)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/deckhd.steamdeck.deckhd-lcd.lua' (id: 4)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.lcd.lua' (id: 5)
[gamescope] [Info]  scriptmgr: Running script file '/usr/share/gamescope/scripts/00-gamescope/displays/valve.steamdeck.oled.lua' (id: 6)
[gamescope] [Info]  scriptmgr: Loading scripts from: '/etc/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/etc/gamescope/scripts' does not exist
[gamescope] [Info]  scriptmgr: Loading scripts from: '/home/fxbt/.config/gamescope/scripts'
[gamescope] [Warn]  scriptmgr: Directory '/home/fxbt/.config/gamescope/scripts' does not exist
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
[gamescope] [Info]  vulkan: selecting physical device 'AMD Radeon RX 6650 XT (RADV NAVI23)': queue family 1 (general queue family 0)
[gamescope] [Info]  vulkan: physical device supports DRM format modifiers
[gamescope] [Info]  wlserver: [backend/headless/backend.c:67] Creating headless backend
[gamescope] [Info]  xdg_backend: Seat name: Hyprland
[gamescope] [Info]  vulkan: supported DRM formats for sampling usage:
[gamescope] [Info]  vulkan:   AR24 (0x34325241)
[gamescope] [Info]  vulkan:   XR24 (0x34325258)
[gamescope] [Info]  vulkan:   AB24 (0x34324241)
[gamescope] [Info]  vulkan:   XB24 (0x34324258)
[gamescope] [Info]  vulkan:   RG16 (0x36314752)
[gamescope] [Info]  vulkan:   AB4H (0x48344241)
[gamescope] [Info]  vulkan:   XB4H (0x48344258)
[gamescope] [Info]  vulkan:   AB48 (0x38344241)
[gamescope] [Info]  vulkan:   XB48 (0x38344258)
[gamescope] [Info]  vulkan:   AB30 (0x30334241)
[gamescope] [Info]  vulkan:   XB30 (0x30334258)
[gamescope] [Info]  vulkan:   AR30 (0x30335241)
[gamescope] [Info]  vulkan:   XR30 (0x30335258)
[gamescope] [Info]  wlserver: Using explicit sync when available
[gamescope] [Info]  wlserver: Running compositor on wayland display 'gamescope-0'
[gamescope] [Info]  wlserver: [backend/headless/backend.c:17] Starting headless backend
[gamescope] [Info]  wlserver: Successfully initialized libei for input emulation!
[gamescope] [Info]  wlserver: [xwayland/server.c:107] Starting Xwayland on :1
[gamescope] [Info]  pipewire: stream state changed: connecting
[gamescope] [Info]  pipewire: stream state changed: paused
[gamescope] [Info]  pipewire: stream available on node ID: 100
[gamescope] [Info]  xwm: Embedded, no cursor set. Using left_ptr by default.
[gamescope] [Info]  vblank: Using timerfd.
[gamescope] [Info]  edid: Patching res 800x1280 -> 1280x720
[gamescope] [Error] xwm: NO CURSOR IMPL XDG
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 708, clipping.
>                   X11 cannot support keycodes above 255.
> Warning:          Could not resolve keysym XF86KbdInputAssistPrevgrou
> Warning:          Could not resolve keysym XF86KbdInputAssistNextgrou
Errors from xkbcomp are not fatal to the X server
[gamescope] [Info]  xdg_backend: Changed refresh to: 164.999hz
[gamescope] [Info]  launch: Primary child shut down!
(EE) failed to read Wayland events: Broken pipe

effectsbot avatar Feb 05 '25 21:02 effectsbot

Getting this issue as well with CS2. Similar logs I do have I do have these extra in there

[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344241 (VkResult: 0)
[gamescope] [Error] vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x38344258 (VkResult: 0)

But I think unrelated. Weird thing is that SHIFT + TAB doesnt work but TAB then Shift opens overlay... def issues with the key mapping

codevski avatar Feb 06 '25 06:02 codevski

Experiencing the same issue without the --expose-overlay launch option (if that even has to do anything with input). Shift + Tab also doesn't work but tab+shift does.

AngelBePro avatar Feb 06 '25 11:02 AngelBePro

Same issue here, Shift + Tab doesn't work. Tab + Shift works.

Was functional three days ago.

CS2 Cachyos - Hyprland.

XKB_DEFAULT_LAYOUT=de game-performance gamescope -w 2560 -h 1440 -r 165 --force-grab-cursor --fullscreen --  %command%

luminoucid avatar Feb 06 '25 21:02 luminoucid

Looks like an update to Xwayland (v24.1.5-1) on Arch causes this issue to appear on Xwayland clients as well, at least for me.

effectsbot avatar Feb 06 '25 22:02 effectsbot

Looks like an update to Xwayland (v24.1.5-1) on Arch causes this issue to appear on Xwayland clients as well, at least for me.

Can confirm, downgrading to xorg-xwayland-24.1.4.1 fixes the issue, for anyone running on arch based system and has the previos version in cache: sudo pacman -U /var/cache/pacman/pkg/xorg-xwayland-24.1.4-1-x86_64.pkg.tar.zst

Lund1337 avatar Feb 09 '25 13:02 Lund1337

Hello, a regression in a system-wide package should be reported to and evaluated by that project's maintainer(s).

Upstream: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1790

kisak-valve avatar Feb 09 '25 14:02 kisak-valve

There are three cases being discussed here:

  1. gamescope --expose-wayland -- alacritty with any version of Xwayland
  2. gamescope -- alacritty with Xwayland 24.1.4
  3. gamescope -- alacritty with Xwayland 24.1.5

In cases 1 and 3, modifiers (such as shift) have no effect.

In case 2, everything works as expected.

The bug is twofold:

  • When running under wayland, gamescope essentially ignores the XKB state from the wayland compositor. It instead creates its own state machine and treats wayland key events as raw input.
  • But it also doesn't run the XKB state machine properly and never sends any modifier events to its clients.

This issue initially confused me because it was opened so close to the Xwayland 24.1.5 release. However, if you use the --expose-wayland command, then Xwayland is not involved and that allows us to remove Xwayland as the source of the issue.

It would be interesting to know if --expose-wayland ever worked and if this is a recent regression.

The reason that this works with Xwayland 24.1.4 is that this version of Xwayland (and all previous versions) ran the XKB state machine on its own. This caused the gamescope bug to be hidden as long as --expose-wayland was not being used. However, this Xwayland behavior was a bug and was fixed in https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1758 which is part of Xwayland 24.1.5.

mahkoh avatar Feb 09 '25 18:02 mahkoh

Can confirm the I exhibit this issue playing CS2 (XWayland) through gamescope on NixOS. I cannot type anything using shift (underscores, upper case letters, etc). Downgrading XWayland seems like the workaround for now.

fxzzi avatar Feb 09 '25 19:02 fxzzi

@mahkoh from what I can tell --expose-wayland has never worked properly. at least it doesnt as far back as 3.14.19 which is as far back as I can get a usable build where --expose-wayland shows a window at all

matte-schwartz avatar Feb 09 '25 19:02 matte-schwartz

The change has been reverted in the Xwayland 24.1 branch.

The change will still be in the 25.1 release which should be released sometime between March and May if the trend holds. gamescope should get fixed before then.

mahkoh avatar Feb 11 '25 10:02 mahkoh

I noticed the same issue when playing dota via gamescope, mostly because this seems to generally affect modifier keys, so that ALT and CTRL also don't work in combination with other keys. When only ALT or CTRL are pressed, the game gives the appropriate response, but as soon as another key is pressed, it's as if ALT, SHIFT or CTRL are not even there. This happens under gamescope with AND without --expose-wayland, but not when the game is an XWayland Client started on the native WM without gamescope. All the tests were done on wayland

fbachus avatar Feb 20 '25 13:02 fbachus

I forgot about that particular gamescope issue and re-cherry-picked the change in Xwayland (as it was fixing a bug for me) but now I realize that gamescope is still affected by this issue, hence I'll re-revert the change in Xwayland again.

But the change is still in the main branch and will eventually be included in the next stable branch of Xwayland, probably in 26.1.

Any plan to get this issue fixed in gamescope?

ofourdan avatar Oct 15 '25 13:10 ofourdan