Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt key remains stuck while switching focus between certain applications and workspaces #1202

Closed
maxigaz opened this issue Dec 10, 2024 · 7 comments

Comments

@maxigaz
Copy link

maxigaz commented Dec 10, 2024

Summary

On Sway 1.10, while the window of certain games are in focus, the Alt key remains stuck if I switch to a different workspace and back to the one the game's window is on.

This happens only in certain cases, depending on what is running on the other workspace. For example, let's say the game is running on workspace 1. Now, on workspace 2:

  • If Firefox or Anki is open, the bug doesn't occur.
  • If Alacritty or Kid3 is open, the issue does occur.

Steps to Reproduce

  1. Switch to workspace 2 by pressing LWin + 2.
  2. Open a window of Alacritty.
  3. Switch to workspace 1 by pressing LWin + 1.
  4. Launch ScummVM from the app launcher (I use Fuzzel, which is run with LAlt + Space).
  5. When ScummVM's window appears (in full screen), switch to workspace 2 and make sure Alacritty is in focus.
  6. Switch back to workspace 1.
  7. Press the Enter key.

The result: ScummVM switches to windowed mode, as if you pressed LAlt + Enter.

Expected Behavior

On pressing Enter, a menu item or dialogue window should be selected in ScummVM (same as clicking or double clicking on whatever is highlighted).

Output of fcitx5-diagnose command

System Info:

  1. uname -a:

    Linux 6.12.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 22 Nov 2024 16:04:27 +0000 x86_64 GNU/Linux
    
  2. lsb_release:

    lsb_release not found.

  3. /etc/lsb-release:

    /etc/lsb-release not found.

  4. /etc/os-release:

    NAME="Arch Linux"
    PRETTY_NAME="Arch Linux"
    ID=arch
    BUILD_ID=rolling
    ANSI_COLOR="38;2;23;147;209"
    HOME_URL="https://archlinux.org/"
    DOCUMENTATION_URL="https://wiki.archlinux.org/"
    SUPPORT_URL="https://bbs.archlinux.org/"
    BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
    PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
    LOGO=archlinux-logo
    
  5. Desktop Environment:

    Cannot determine desktop environment.

  6. XDG SESSION TYPE:

    XDG_SESSION_TYPE='wayland'
    
  7. Bash Version:

    BASH_VERSION='5.2.37(1)-release'
    

Environment:

  1. DISPLAY:

    DISPLAY=':0'
    
    
    WAYLAND_DISPLAY='wayland-1'
    
  2. Keyboard Layout:

    1. setxkbmap:

      WARNING: Running setxkbmap against an Xwayland server
      xkb_keymap {
      	xkb_keycodes  { include "evdev+aliases(qwertz)"	};
      	xkb_types     { include "complete"	};
      	xkb_compat    { include "complete"	};
      	xkb_symbols   { include "pc+hu+inet(evdev)+capslock(escape_shifted_capslock)+compose(rwin)"	};
      	xkb_geometry  { include "pc(pc105)"	};
      };
      
    2. xprop:

      _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "hu", "", "compose:rwin,caps:escape_shifted_capslock"
      
  3. Locale:

    1. All locales:

      C
      C.utf8
      POSIX
      en_GB
      en_GB.iso88591
      en_GB.utf8
      en_US
      en_US.iso88591
      en_US.utf8
      hu_HU
      hu_HU.iso88592
      hu_HU.utf8
      hungarian
      ja_JP
      ja_JP.eucjp
      ja_JP.ujis
      ja_JP.utf8
      japanese
      japanese.euc
      
    2. Current locale:

      LANG=en_GB.UTF-8
      LC_CTYPE="C"
      LC_NUMERIC="C"
      LC_TIME="C"
      LC_COLLATE="C"
      LC_MONETARY="C"
      LC_MESSAGES="C"
      LC_PAPER="C"
      LC_NAME="C"
      LC_ADDRESS="C"
      LC_TELEPHONE="C"
      LC_MEASUREMENT="C"
      LC_IDENTIFICATION="C"
      LC_ALL=C
      
  4. Directories:

    1. Home:

      /home/maxigaz
      
    2. ${XDG_CONFIG_HOME}:

      Environment variable XDG_CONFIG_HOME is set to /home/maxigaz/.config.

      Current value of XDG_CONFIG_HOME is ~/.config (/home/maxigaz/.config).

    3. Fcitx5 Settings Directory:

      Current fcitx5 settings directory is ~/.config/fcitx5 (/home/maxigaz/.config/fcitx5).

  5. Current user:

    The script is run as maxigaz (1000).

Fcitx State:

  1. executable:

    Found fcitx5 at /usr/bin/fcitx5.

  2. version:

    Fcitx version: 5.1.11

  3. process:

    Found 1 fcitx5 process:

     144412 fcitx5
    
  4. fcitx5-remote:

    fcitx5-remote works properly.

  5. DBus interface:

    Using dbus-send to check dbus.

    Owner of DBus name org.fcitx.Fcitx5 is :1.175.

    PID of DBus name org.fcitx.Fcitx5 owner is 144412.

    Debug information from dbus:

       Group [wayland:] has 2 InputContext(s)
      IC [3ef430bd2cad4a9cbaa91a477567c986] program:Alacritty frontend:wayland_v2 cap:100000072 focus:1
      IC [902062be6ad24203bbe037c10ca994d7] program: frontend:wayland_v2 cap:100000072 focus:0
    Group [x11::0] has 0 InputContext(s)
    Input Context without group
    

Fcitx Configure UI:

  1. Config Tool Wrapper:

    Found fcitx5-configtool at /usr/bin/fcitx5-configtool.

  2. Config GUI for qt:

    Found fcitx5-config-qt at /usr/bin/fcitx5-config-qt.

  3. Config GUI for kde:

    kcmshell5 not found.

Frontends setup:

The environment variable checked by this script only shows the environment under current shell. It is still possible that you did not set the environment to the whole graphic desktop session. You may inspect the actual environment variable of a certain process by using xargs -0 -L1 /proc/$PID/environ for a certain process that you find not working.

Xim:

  1. ${XMODIFIERS}:

    Environment variable XMODIFIERS is set to "@im=fcitx" correctly.
    Xim Server Name from Environment variable is fcitx.

  2. XIM_SERVERS on root window:

    Xim server name is the same with that set in the environment variable.

  3. XIM encoding:

    Your LC_CTYPE is set to C whose encoding is not UTF-8. You may have trouble committing strings using XIM.

Qt:

  1. qt4 - ${QT4_IM_MODULE}:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    fcitx5-qt4-immodule-probing not found.

  2. qt5 - ${QT_IM_MODULE}:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-qt5-immodule-probing to check the actual im module to be used under current environment:

    QT_QPA_PLATFORM=wayland
    QT_IM_MODULE=fcitx
    IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext
    
  3. qt6 - ${QT_IM_MODULE}:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-qt6-immodule-probing to check the actual im module to be used under current environment:

    QT_QPA_PLATFORM=wayland
    QT_IM_MODULE=fcitx
    IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext
    
  4. Qt IM module files:

    Found fcitx5 im module for qt: /usr/lib/qt/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so.
    Found fcitx5 qt6 module: /usr/lib/fcitx5/qt6/libfcitx-quickphrase-editor5.so.
    Found fcitx5 qt5 module: /usr/lib/fcitx5/qt5/libfcitx-quickphrase-editor5.so.
    Found unknown fcitx qt module: /usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_fcitx5.so.
    Found fcitx5 im module for qt6: /usr/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so.

    Following error may not be accurate because guessing Qt version from path depends on how your distribution packages Qt. It is not a critical error if you do not use any Qt application with certain version of Qt or you are using text-input support by Qt under Wayland.
    Cannot find fcitx5 input method module for Qt4.

Gtk:

  1. gtk - ${GTK_IM_MODULE}:

    Environment variable GTK_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-gtk2-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=fcitx
    

    Using fcitx5-gtk3-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=fcitx
    

    Using fcitx5-gtk4-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=fcitx
    
  2. gtk-query-immodules:

    1. gtk 2:

      Found gtk-query-immodules for gtk 2.24.33 at /usr/bin/gtk-query-immodules-2.0.
      Version Line:

      # Created by /usr/bin/gtk-query-immodules-2.0 from gtk+-2.24.33
      

      Found fcitx5 im modules for gtk 2.24.33.

      "/usr/lib/gtk-2.0/2.10.0/immodules/im-fcitx5.so" 
      "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      
    2. gtk 3:

      Found gtk-query-immodules for gtk 3.24.43 at /usr/bin/gtk-query-immodules-3.0.
      Version Line:

      # Created by /usr/bin/gtk-query-immodules-3.0 from gtk+-3.24.43
      

      Found fcitx5 im modules for gtk 3.24.43.

      "/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
      "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      

      Found gtk-query-immodules for gtk 3.24.43 at /usr/bin/gtk-query-immodules-3.0-32.
      Version Line:

      # Created by /usr/bin/gtk-query-immodules-3.0-32 from gtk+-3.24.43
      

      Failed to find fcitx5 in the output of /usr/bin/gtk-query-immodules-3.0-32

  3. Gtk IM module cache:

    1. gtk 2:

      Found immodules cache for gtk 2.24.33 at /usr/lib/gtk-2.0/2.10.0/immodules.cache.
      Version Line:

      # Created by /usr/bin/gtk-query-immodules-2.0 from gtk+-2.24.33
      

      Found fcitx5 im modules for gtk 2.24.33.

      "/usr/lib/gtk-2.0/2.10.0/immodules/im-fcitx5.so" 
      "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      
    2. gtk 3:

      Found immodules cache for gtk 3.24.43 at /usr/lib/gtk-3.0/3.0.0/immodules.cache.
      Version Line:

      # Created by /usr/bin/gtk-query-immodules-3.0 from gtk+-3.24.43
      

      Found fcitx5 im modules for gtk 3.24.43.

      "/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so" 
      "fcitx" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      "fcitx5" "Fcitx5 (Flexible Input Method Framework5)" "fcitx5" "/usr/locale" "ja:ko:zh:*" 
      

      Found immodules cache for gtk 3.24.43 at /usr/lib32/gtk-3.0/3.0.0/immodules.cache.
      Version Line:

      # Created by /usr/bin/gtk-query-immodules-3.0-32 from gtk+-3.24.43
      

      Failed to find fcitx5 in immodule cache at /usr/lib32/gtk-3.0/3.0.0/immodules.cache

  4. Gtk IM module files:

    1. gtk 2:

      All found Gtk 2 immodule files exist.

    2. gtk 3:

      All found Gtk 3 immodule files exist.

    3. gtk 4:

      All found Gtk 4 immodule files exist.

Configuration:

Fcitx Addons:

  1. Addon Config Dir:

    Found fcitx5 addon config directory: /usr/share/fcitx5/addon.

  2. Addon List:

    1. Found 21 enabled addons:

      Anthy 5.1.5
      Classic User Interface 5.1.11
      Clipboard 5.1.11
      DBus 5.1.11
      DBus Frontend 5.1.11
      Emoji 5.1.11
      Fcitx4 Frontend 5.1.11
      IBus Frontend 5.1.11
      Input method selector 5.1.11
      Keyboard 5.1.11
      KDE Input Method Panel 5.1.11
      Status Notifier 5.1.11
      Notification 5.1.11
      Quick Phrase 5.1.11
      Spell 5.1.11
      Unicode 5.1.11
      DBus Virtual Keyboard 5.1.11
      Wayland 5.1.11
      Wayland Input method frontend 5.1.11
      XCB 5.1.11
      X Input Method Frontend 5.1.11
      
    2. Found 0 disabled addons:

  3. Addon Libraries:

    All libraries for all addons are found.

  4. User Interface:

    Found 3 enabled user interface addons:

    Classic User Interface
    KDE Input Method Panel
    DBus Virtual Keyboard
    

Input Methods:

  1. /home/maxigaz/.config/fcitx5/profile:

    [Groups/0]
    # Group Name
    Name=Default
    # Layout
    Default Layout=hu
    # Default Input Method
    DefaultIM=anthy
    
    [Groups/0/Items/0]
    # Name
    Name=keyboard-hu
    # Layout
    Layout=
    
    [Groups/0/Items/1]
    # Name
    Name=keyboard-us
    # Layout
    Layout=
    
    [Groups/0/Items/2]
    # Name
    Name=anthy
    # Layout
    Layout=
    
    [GroupOrder]
    0=Default
    

Log:

  1. date:

    Tue Dec 10 13:42:29 CET 2024
    
  2. /home/maxigaz/.config/fcitx5/crash.log:

    =========================
    Fcitx 5.0.11 -- Get Signal No.: 11
    Date: try "date -d @1642352833" if you are using GNU date ***
    ProcessID: 1321
    fcitx5(+0xbc54)[0x55ffd050fc54]
    /usr/lib/libc.so.6(+0x3cda0)[0x7fbb0b2fcda0]
    /usr/lib/fcitx5/libxim.so(+0x956f)[0x7fbb09a8c56f]
    /usr/lib/libFcitx5Core.so.7(_ZNK5fcitx8Instance9postEventERNS_5EventE+0x324)[0x7fbb0b80d904]
    /usr/lib/libFcitx5Core.so.7(_ZN5fcitx12InputContext19updateUserInterfaceENS_22UserInterfaceComponentEb+0x8e)[0x7fbb0b838e9e]
    /usr/lib/libFcitx5Core.so.7(_ZN5fcitx8Instance21deactivateInputMethodERNS_17InputContextEventE+0x5db)[0x7fbb0b80e50b]
    /usr/lib/libFcitx5Core.so.7(_ZNK5fcitx8Instance9postEventERNS_5EventE+0x324)[0x7fbb0b80d904]
    /usr/lib/libFcitx5Core.so.7(_ZN5fcitx12InputContext11setHasFocusEb+0xb0)[0x7fbb0b8387b0]
    /usr/lib/libFcitx5Core.so.7(_ZN5fcitx10FocusGroup22setFocusedInputContextEPNS_12InputContextE+0xa8)[0x7fbb0b837958]
    /usr/lib/fcitx5/libxim.so(+0x6f63)[0x7fbb09a89f63]
    /usr/lib/libxcb-imdkit.so.1(+0xfb63)[0x7fbb099d3b63]
    /usr/lib/libxcb-imdkit.so.1(+0xc270)[0x7fbb099d0270]
    /usr/lib/libxcb-imdkit.so.1(xcb_im_filter_event+0x3d)[0x7fbb099d0c0d]
    /usr/lib/fcitx5/libxim.so(+0x9408)[0x7fbb09a8c408]
    /usr/lib/fcitx5/libxcb.so(+0x1248b)[0x7fbb0a61a48b]
    /usr/lib/libFcitx5Utils.so.2(+0x4bb57)[0x7fbb0b74db57]
    /usr/lib/libFcitx5Utils.so.2(+0x4b55c)[0x7fbb0b74d55c]
    /usr/lib/libFcitx5Utils.so.2(+0x4388f)[0x7fbb0b74588f]
    /usr/lib/libsystemd.so.0(+0x7a04b)[0x7fbb0b1e204b]
    /usr/lib/libsystemd.so.0(sd_event_dispatch+0x13e)[0x7fbb0b1e224e]
    /usr/lib/libsystemd.so.0(sd_event_run+0x119)[0x7fbb0b1e4f59]
    /usr/lib/libsystemd.so.0(sd_event_loop+0x60)[0x7fbb0b1e5130]
    /usr/lib/libFcitx5Utils.so.2(_ZN5fcitx9EventLoop4execEv+0x12)[0x7fbb0b745962]
    /usr/lib/libFcitx5Core.so.7(_ZN5fcitx8Instance4execEv+0x57)[0x7fbb0b8149b7]
    fcitx5(+0xaaa2)[0x55ffd050eaa2]
    /usr/lib/libc.so.6(__libc_start_main+0xd5)[0x7fbb0b2e7b25]
    fcitx5(+0xae9e)[0x55ffd050ee9e]
    

Warning: the output of fcitx5-diagnose contains sensitive information, including the distribution name, kernel version, name of currently running programs, etc.

Though such information can be helpful to developers for diagnostic purpose, please double check and remove as necessary before posting it online publicly.

@wengxt
Copy link
Member

wengxt commented Dec 10, 2024

Does the issue appear only in ScummVM (e.g. not firefox or other app you mentioned?) and does it use SDL?

If so, please report to sdl instead.

As workaround try for sdl to run x11 (SDL_VIDEODRIVER)

When report the bug, attach the log of scummvm with
WAYLAND_DEBUG=1 (maybe filter the log against wl_keyboard and text_input_v3)

@maxigaz
Copy link
Author

maxigaz commented Dec 11, 2024

Does the issue appear only in ScummVM (e.g. not firefox or other app you mentioned?) and does it use SDL?

I've just done some further testing. Apart from ScummVM, I can reproduce the issue with the following games:

  • Julius 1.7.0 (native Linux version, running with SDL_VIDEODRIVER=x11 because native Wayland mode makes the game crash at startup)
  • Zeus (2000 game, running through Wine)
  • Stronghold (2001 game, running through Wine)
  • Coffee Talk (2020 game, running through Wine)

The issue doesn't occur with Firefox at all.

As workaround try for sdl to run x11 (SDL_VIDEODRIVER)

It doesn't make any difference whether I set SDL_VIDEODRIVER to x11 or wayland in the case of ScummVM.

However, I did discover the following:

  • For Julius, it is not LAlt but LWin that stays stuck (I need to press that button to get other keys to work again), regardless of whether I run it from the terminal or fuzzel.
  • For the rest of the games I've mentioned so far, they almost always work perfectly when they are launched from the terminal. (I don't know why.)
  • If I run pkill fcitx5 before launching any of the games, the issue never occurs.

If so, please report to sdl instead.

I'm really not sure what is causing the issue exactly, but sure, I can try reporting it to them later.

@wengxt
Copy link
Member

wengxt commented Dec 11, 2024

If wine is involved, then it's probably related to xwayland.

There's one fix I can try. While it was causing issue in sway 1.9, swaywm/sway#8143

1.10 should already merge the fix.

Can you try revert this and see if it helps?
45c024a

@maxigaz
Copy link
Author

maxigaz commented Dec 12, 2024

What's the correct way of compiling fcitx5 from source if I don't want to overwrite any system files managed by pacman?

I've just looked at the PKGBUILD for Arch Linux, and tried the following commands:

git clone https://github.com/fcitx/fcitx5/ && cd fcitx5
cmake -GNinja -DCMAKE_BUILD_TYPE=Release .
ninja

After they successfully run, I can't find any executable with the name fcitx5 anywhere in any of the subdirectories.

I've also taken a look at the building instructions here, but ninja is not mentioned here at all, so I'm confused.

@wengxt
Copy link
Member

wengxt commented Dec 12, 2024

@maxigaz I suggest you make a copy of arch's pkgbuild.

revert the patch above in pkgbuild and build your own fcitx5 package. Then you can just install it with pacman.

If you think things goes wrong just simply do pacman -S fcitx5 to install the official version (shouldn't require internet if you still have it in the cache.)

@maxigaz
Copy link
Author

maxigaz commented Dec 12, 2024

OK, I've just compiled and installed the package fcitx5-git with 45c024a reverted. All the games I mentioned earlier work perfectly now (including ScummVM in native Wayland mode).

@wengxt
Copy link
Member

wengxt commented Dec 12, 2024

@maxigaz thanks, I'm glad it works. I may revert this change but leave an option to allow people to workaround the previous issue.

At that time when it was causing issue, sway 1.10 was not released (and some other compositor is having issue too).
Hopefully whoever package the next fcitx release already package the new sway with the fix.

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

No branches or pull requests

2 participants