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

Input Signal Target not Correct in Hyprland #1031

Closed
The-Lost-Light opened this issue Apr 26, 2024 · 4 comments
Closed

Input Signal Target not Correct in Hyprland #1031

The-Lost-Light opened this issue Apr 26, 2024 · 4 comments

Comments

@The-Lost-Light
Copy link

The-Lost-Light commented Apr 26, 2024

Describe the bug
在fcitx5 5.1.9更新(降級至5.1.8後正常運作)之後, 在hyprland中快速切換焦點(A->B->A)會導致聚焦於A程式但輸入是對B程式的
After the fcitx5 5.1.9 update(downgrade to 5.1.8 still working fine), quickly switching focus (A->B->A) in hyprland will cause the focus to be on program A but the input is to program B.

To Reproduce

  1. open app1 and app2
  2. switching focus to app2 and return to app1 quickly
  3. any type is send to app2 even though the focus is on app1
    (dragging the window can temporarily solve the problem)

Expected behavior
app1 got the type when focus

Desktop (please complete the following information):

  • Desktop: Hyprland 0.39.1
  • Display server type: Wayland
The output of fcitx5-diagnose # System Info: 1. `uname -a`:
    Linux mono 6.8.7-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024 15:20:00 +0000 x86_64 GNU/Linux
  1. lsb_release -a:

    LSB Version:	n/a
    Distributor ID:	Arch
    Description:	Arch Linux
    Release:	rolling
    Codename:	n/a
    
  2. lsb_release -d:

    Description:	Arch Linux
    
  3. /etc/lsb-release:

    DISTRIB_ID="Arch"
    DISTRIB_RELEASE="rolling"
    DISTRIB_DESCRIPTION="Arch Linux"
    
  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.26(1)-release'
    

Environment:

  1. DISPLAY:

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

    1. setxkbmap:

      WARNING: Running setxkbmap against an Xwayland server
      xkb_keymap {
      	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
      	xkb_types     { include "complete"	};
      	xkb_compat    { include "complete"	};
      	xkb_symbols   { include "pc+us+inet(evdev)"	};
      	xkb_geometry  { include "pc(pc105)"	};
      };
      
    2. xprop:

      _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", ""
      
  3. Locale:

    1. All locales:

      C
      C.utf8
      en_US.utf8
      ja_JP.utf8
      POSIX
      zh_CN.utf8
      zh_TW.utf8
      
    2. Current locale:

      LANG=en_US.utf8
      LC_CTYPE="en_US.utf8"
      LC_NUMERIC="en_US.utf8"
      LC_TIME="en_US.utf8"
      LC_COLLATE="en_US.utf8"
      LC_MONETARY="en_US.utf8"
      LC_MESSAGES="en_US.utf8"
      LC_PAPER="en_US.utf8"
      LC_NAME="en_US.utf8"
      LC_ADDRESS="en_US.utf8"
      LC_TELEPHONE="en_US.utf8"
      LC_MEASUREMENT="en_US.utf8"
      LC_IDENTIFICATION="en_US.utf8"
      LC_ALL=
      
  4. Directories:

    1. Home:

      /home/mono
      
    2. ${XDG_CONFIG_HOME}:

      Environment variable XDG_CONFIG_HOME is not set.

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

    3. Fcitx5 Settings Directory:

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

  5. Current user:

    The script is run as mono (1000).

Fcitx State:

  1. executable:

    Found fcitx5 at /usr/bin/fcitx5.

  2. version:

    Fcitx version: 5.1.9

  3. process:

    Found 1 fcitx5 process:

      29716 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.245.

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

    Debug information from dbus:

       Group [wayland:] has 3 InputContext(s)
      IC [6bb345fa4117484e8ef7968a4dc152f9] program:kitty frontend:wayland_v2 cap:100000072 focus:1
      IC [7fdda9365ed5486d9050080098119f2d] program:nwg-drawer frontend:dbus cap:6001000032 focus:0
      IC [80be1150b3774b558ba9b48735996692] program: frontend:wayland_v2 cap:100000072 focus:0
    Group [x11::1] 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.

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 im module for qt6: /usr/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so.
    Found unknown fcitx qt module: /usr/lib/qt6/plugins/plasma/kcms/systemsettings/kcm_fcitx5.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.

    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.41 at /usr/bin/gtk-query-immodules-3.0.
      Version Line:

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

      Found fcitx5 im modules for gtk 3.24.41.

      "/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:*" 
      
  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.41 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.41
      

      Found fcitx5 im modules for gtk 3.24.41.

      "/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:*" 
      
  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:

      Classic User Interface 5.1.9
      Clipboard 5.1.9
      DBus 5.1.9
      DBus Frontend 5.1.9
      Emoji 5.1.9
      Fcitx4 Frontend 5.1.9
      IBus Frontend 5.1.9
      Input method selector 5.1.9
      Keyboard 5.1.9
      KDE Input Method Panel 5.1.9
      McBopomofo 2.7
      Status Notifier 5.1.9
      Notification 5.1.9
      Quick Phrase 5.1.9
      Spell 5.1.9
      Unicode 5.1.9
      DBus Virtual Keyboard 5.1.9
      Wayland 5.1.9
      Wayland Input method frontend 5.1.9
      XCB 5.1.9
      X Input Method Frontend 5.1.9
      
    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/mono/.config/fcitx5/profile:

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

Log:

  1. date:

    Sat Apr 27 12:57:29 AM CST 2024
    
  2. /home/mono/.config/fcitx5/crash.log:

    /home/mono/.config/fcitx5/crash.log not found.

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.**sudo

Additional context
Kooha-2024-04-27-00-53-07.webm

Kooha-2024-04-27-00-53-07.webm

@yutkat
Copy link

yutkat commented Apr 26, 2024

I just had this problem and was investigating it.

In my case, if I held down the mod key (Windows key) and changed windows, I could not type in the terminal (wezterm/alacritty/kitty etc).
If I release the mod key once, I can type in the terminal.

@wengxt
Copy link
Member

wengxt commented Apr 26, 2024

So I need to this explain a little bit about how zwp_input_method_v2 works.

Fcitx has ZERO knowledge about App from zwp_input_method_v2, and it can't differentiate if there is 1 or 2 or 3 apps.
The app you see in DebugInfo, is obtained from a side path that is also used to implement task manager. Fcitx can not control which application it is sending text to with zwp_input_method_v2

Basically, when fcitx send some text, it just send it to compositor blindly, and expect compositor to route it to the correct application. So this can only be a compositor bug. The focus management of text-input is done on the compositor side.

There may be some change triggered a bug in hyprland, but it's definitely not a fcitx bug.

@clsty
Copy link

clsty commented Apr 27, 2024

There may be some change triggered a bug in hyprland, but it's definitely not a fcitx bug.

I may just have found the change. b2924bd

By using git bisect, this is the result I get:

b2924bd361680c493463d240a375b3f0948ae48d is the first bad commit
commit b2924bd361680c493463d240a375b3f0948ae48d
Author: Weng Xuetian <wengxt@gmail.com>
Date:   Fri Mar 1 09:18:50 2024 -0800

    Destroy virtual keyboard when it is not activated.
    
    This seems to be a good idea to clear up all the xkb state we sent from
    vk. This seems also fix the hyprland issue that modifier is pressed when
    switch window.

 src/frontend/waylandim/waylandimserverv2.cpp | 20 ++++++++++++--------
 src/frontend/waylandim/waylandimserverv2.h   |  4 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

@wengxt
Copy link
Member

wengxt commented Apr 27, 2024

@clsty yes, but I have no intention to change it back. Please report bug to hyprland. I ideally include the WAYLAND_DEBUG=1 log from two app.

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

4 participants