fcitx / fcitx5

maybe a new fcitx.
1.62k stars 118 forks source link

Pasting text from a Qt application to Firefox sometimes fails #702

Closed tgn-ff closed 1 year ago

tgn-ff commented 1 year ago

STR:

  1. Open a Firefox window.
  2. Copy some text from a Qt application. I used KDE's Kate.
  3. Paste the text in Firefox's urlbar.
  4. Copy some other text from the Qt application.
  5. Open a new tab in Firefox and try to paste it in the urlbar.

Results:

The text needs a lot of tries (Ctrl + V) before it is, actually, pasted. fitx5 needs to be running, but not necessarily be in use, ie. it happens when English is the selected language (with the IME off).

One workaround is to set Ctrl + V (same as system's clipboard) as the "Paste Primary" shortcut in the Clipboard Module. I'm not sure if this causes some other input issues I have, though.


I ran a bisection and ended up at the following commit as the culprit:


commit c7725763d1b608161233ef62396a073a6004c27d
Author: Weng Xuetian <wengxt@gmail.com>
Date:   Sat Nov 12 09:58:04 2022 -0800

    Seems firefox doesn't like the batch mode call sequence.

    ProcessKeyEventBatch is introduced to mainly workaround Gtk4 limitation.
    While it does helps and ideally it should work on gtk2, and gtk3,
    certain app (namely firefox) doesn't like it. So lets just revert gtk2/3
    back to the old behavior, since they have been working well and no one
    complain about it. hangul case is tested, gtk3 works well and
    fcitx/fcitx5#445 does not happen.

    Fix fcitx/fcitx5-gtk#22

 fcitx-gclient/fcitxgclient.c | 45 ++++++++++++++++++++++++++++++++++++--------
 fcitx-gclient/fcitxgclient.h |  2 ++
 gtk2/fcitximcontext.cpp      |  1 +
 gtk3/fcitximcontext.cpp      |  1 +
 4 files changed, 41 insertions(+), 8 deletions(-)```
wengxt commented 1 year ago

can you paste the output of fcitx5-diagnose while qt and firefox are running?

tgn-ff commented 1 year ago

Of course. Here you go:

# System Info:
1.  `uname -a`:

        Linux xenomorph-pc 6.1.5-arch2-1 fcitx/fcitx5-gtk#1 SMP PREEMPT_DYNAMIC Thu, 12 Jan 2023 22:42:33 +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://bugs.archlinux.org/"
        PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
        LOGO=archlinux-logo

5.  Desktop Environment:

    Desktop environment is `kde`.

6.  XDG SESSION TYPE:

        XDG_SESSION_TYPE='x11'

7.  Bash Version:

        BASH_VERSION='5.1.16(1)-release'

# Environment:
1.  DISPLAY:

        DISPLAY=':1'

        WAYLAND_DISPLAY=''

2.  Keyboard Layout:

    1.  `setxkbmap`:

            xkb_keymap {
                xkb_keycodes  { include "evdev+aliases(qwerty)" };
                xkb_types     { include "complete"  };
                xkb_compat    { include "complete"  };
                xkb_symbols   { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)"    };
                xkb_geometry  { include "pc(pc105)" };
            };

    2.  `xprop`:

            _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", "terminate:ctrl_alt_bksp"

3.  Locale:

    1.  All locales:

            C
            C.UTF-8
            el_GR.utf8
            en_GB.utf8
            en_US.utf8
            POSIX

    2.  Current locale:

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

4.  Directories:

    1.  Home:

            /home/xenomorph

    2.  `${XDG_CONFIG_HOME}`:

        Environment variable `XDG_CONFIG_HOME` is not set.

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

    3.  Fcitx5 Settings Directory:

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

5.  Current user:

    The script is run as xenomorph (1000).

# Fcitx State:
1.  executable:

    Found fcitx5 at `/usr/bin/fcitx5`.

2.  version:

    Fcitx version: `5.0.21`

3.  process:

    Found 2 fcitx5 processes:

          35870 fcitx5
          35905 fcitx5-plasma-t

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.301`.

    PID of DBus name `org.fcitx.Fcitx5` owner is `35870`.

    Debug information from dbus:

           Group [x11::1] has 8 InputContext(s)
          IC [de7fc313a1fa4c2e8c8af4396d416795] program:yakuake frontend:dbus cap:6000800072 focus:1
          IC [b795d80aaf034ef4b406d41336f93ffd] program:kate frontend:dbus cap:6000800072 focus:0
          IC [c8fb6caa01b149dda8b1b0d7e1ec0591] program:nightly frontend:dbus cap:6000000012 focus:0
          IC [d5cadaf1262849de96387280ce416395] program:nightly frontend:dbus cap:6000000012 focus:0
          IC [5517e0b5a009433999669fa4d4585fff] program:nightly frontend:dbus cap:6000000052 focus:0
          IC [8d047247b8c54516b9a31987c277f3e2] program:nightly frontend:dbus cap:6000000012 focus:0
          IC [6d0ddaddb1e64a5699f894f5865c74b9] program:nightly frontend:dbus cap:6000000012 focus:0
          IC [ad2a8554a51b40dfb9ec577d9a6a9dc0] program:plasmashell frontend:dbus cap:16000800072 focus:0
        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:

    Found fcitx5 kcm module.

        kcm_fcitx5                     - Configure Input Method

# Frontends setup:
## 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.

2.  qt5 - `${QT_IM_MODULE}`:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

3.  Qt IM module files:

    Found fcitx5 qt5 module: `/usr/lib/fcitx5/qt5/libfcitx-quickphrase-editor5.so`.
    Found unknown fcitx qt module: `/usr/lib/qt/plugins/kcms/kcm_fcitx5.so`.
    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`.

    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.

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

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

        Found fcitx5 im modules for gtk `3.24.36`.

            "/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.36` 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.36

        Found fcitx5 im modules for gtk `3.24.36`.

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

        **Cannot find immodules cache for gtk 4**

        **Cannot find fcitx5 im module for gtk 4 in 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 19 enabled addons:

            Classic User Interface 5.0.21
            Clipboard 5.0.21
            DBus 5.0.21
            DBus Frontend 5.0.21
            Emoji 5.0.21
            Fcitx4 Frontend 5.0.21
            Hangul 5.0.10
            IBus Frontend 5.0.21
            Input method selector 5.0.21
            Keyboard 5.0.21
            Status Notifier 5.0.21
            Notification 5.0.21
            Quick Phrase 5.0.21
            Spell 5.0.21
            Unicode 5.0.21
            Wayland 5.0.21
            Wayland Input method frontend 5.0.21
            XCB 5.0.21
            X Input Method Frontend 5.0.21

    2.  Found 1 disabled addons:

            KDE Input Method Panel 5.0.21

3.  Addon Libraries:

    All libraries for all addons are found.

4.  User Interface:

    Found 1 enabled user interface addons:

        Classic User Interface

## Input Methods:
1.  `/home/xenomorph/.config/fcitx5/profile`:

        [Groups/0]
        # Group Name
        Name="Group 1"
        # Layout
        Default Layout=us
        # Default Input Method
        DefaultIM=hangul

        [Groups/0/Items/0]
        # Name
        Name=keyboard-us
        # Layout
        Layout=

        [Groups/0/Items/1]
        # Name
        Name=keyboard-gr
        # Layout
        Layout=

        [Groups/0/Items/2]
        # Name
        Name=hangul
        # Layout
        Layout=us

        [Groups/0/Items/3]
        # Name
        Name=keyboard-ru-phonetic
        # Layout
        Layout=

        [GroupOrder]
        0="Group 1"

# Log:
1.  `date`:

        Sat 14 Jan 21:32:49 EET 2023

2.  `/home/xenomorph/.config/fcitx5/crash.log`:

    `/home/xenomorph/.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.**
tgn-ff commented 1 year ago

By the way, I run Firefox Nightly with the --name nightly argument which, in the output you requested, changes the programme name to "nightly". This workarounds the original issue fcitx/fcitx5-gtk#22.

wengxt commented 1 year ago

When you press ctrl + v and it doesn't paste any text, what happens? just nothing happens?

Also, when this happens, are both side of the application under using keyboard-us , or are they using something else?

Can you help try to run fcitx5 -r --verbose=key_trace=5 and try to point me to the log being generated when ctrl + v doesn't work? (try to layout the window in a grid so you can see what log is being generated when you press the key).

tgn-ff commented 1 year ago

Nothing happens. I can still type, but not paste anything. It's strange, but most of the time it takes exactly 14 tries before the text is pasted.

Both applications are at the same input language. I have set the "Share Input State" to "All" in the "Global Options." It can be en-US (for which IME is off), or any other; it doesn't seem to matter.

I'm using "##" to comment between the log lines (there are 2 comments):

I2023-01-15 05:21:27.700384 instance.cpp:1270] Override Enabled Addons: {}
I2023-01-15 05:21:27.700409 instance.cpp:1271] Override Disabled Addons: {kimpanel}
I2023-01-15 05:21:27.703138 addonmanager.cpp:191] Loaded addon xcb
I2023-01-15 05:21:27.704241 addonmanager.cpp:191] Loaded addon quickphrase
I2023-01-15 05:21:27.704356 addonmanager.cpp:191] Loaded addon imselector
I2023-01-15 05:21:27.708912 addonmanager.cpp:191] Loaded addon keyboard
I2023-01-15 05:21:27.710056 addonmanager.cpp:191] Loaded addon dbus
I2023-01-15 05:21:27.717718 addonmanager.cpp:191] Loaded addon ibusfrontend
I2023-01-15 05:21:27.718271 addonmanager.cpp:191] Loaded addon xim
E2023-01-15 05:21:27.719454 waylandmodule.cpp:243] Failed to open wayland connection
I2023-01-15 05:21:27.719466 addonmanager.cpp:191] Loaded addon wayland
I2023-01-15 05:21:27.719868 addonmanager.cpp:191] Loaded addon dbusfrontend
I2023-01-15 05:21:27.724169 addonmanager.cpp:191] Loaded addon fcitx4frontend
I2023-01-15 05:21:27.724551 addonmanager.cpp:191] Loaded addon clipboard
I2023-01-15 05:21:27.724708 addonmanager.cpp:191] Loaded addon waylandim
I2023-01-15 05:21:27.724869 addonmanager.cpp:191] Loaded addon unicode
I2023-01-15 05:21:27.754229 inputmethodmanager.cpp:198] Found 723 input method(s) in addon keyboard
I2023-01-15 05:21:27.786577 addonmanager.cpp:191] Loaded addon classicui
I2023-01-15 05:21:27.786937 addonmanager.cpp:191] Loaded addon notificationitem
I2023-01-15 05:21:27.787246 addonmanager.cpp:191] Loaded addon notifications
Will write new themes to:  "/home/xenomorph/.local/share/fcitx5/themes/plasma"
Notify theme reloading.
I2023-01-15 05:21:28.917214 addonmanager.cpp:191] Loaded addon hangul
D2023-01-15 05:21:29.437307 instance.cpp:890] KeyEvent: Key(Control_L states=0) rawKey: Key(Control_L states=16) origKey: Key(Control_L states=16) Release:0
D2023-01-15 05:21:29.437371 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:29.731197 instance.cpp:890] KeyEvent: Key(Control+A states=4) rawKey: Key(Control+a states=20) origKey: Key(Control+a states=20) Release:0
D2023-01-15 05:21:29.731283 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:29.830181 instance.cpp:890] KeyEvent: Key(Control+Control_L states=4) rawKey: Key(Control+Control_L states=20) origKey: Key(Control+Control_L states=20) Release:1
D2023-01-15 05:21:29.830237 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:29.853092 instance.cpp:890] KeyEvent: Key(a states=0) rawKey: Key(a states=16) origKey: Key(a states=16) Release:1
D2023-01-15 05:21:29.853143 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:30.538291 instance.cpp:890] KeyEvent: Key(Control_L states=0) rawKey: Key(Control_L states=16) origKey: Key(Control_L states=16) Release:0
D2023-01-15 05:21:30.538359 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:30.722274 instance.cpp:890] KeyEvent: Key(Control+C states=4) rawKey: Key(Control+c states=20) origKey: Key(Control+c states=20) Release:0
D2023-01-15 05:21:30.722357 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:30.795229 instance.cpp:890] KeyEvent: Key(Control+Control_L states=4) rawKey: Key(Control+Control_L states=20) origKey: Key(Control+Control_L states=20) Release:1
D2023-01-15 05:21:30.795284 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:30.856142 instance.cpp:890] KeyEvent: Key(c states=0) rawKey: Key(c states=16) origKey: Key(c states=16) Release:1
D2023-01-15 05:21:30.856196 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0

##Started trying to paste some text at this point, unsuccesfully.

D2023-01-15 05:21:33.138445 instance.cpp:890] KeyEvent: Key(Control_L states=0) rawKey: Key(Control_L states=16) origKey: Key(Control_L states=16) Release:0
D2023-01-15 05:21:33.138491 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:33.371519 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:33.371604 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:33.494424 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:33.494481 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:34.488521 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:34.488601 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:34.610364 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:34.610414 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:35.089484 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:35.089565 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:35.199402 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:35.199450 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:35.714528 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:35.714598 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:35.825495 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:35.825555 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:36.291551 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:36.291629 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:36.401422 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:36.401477 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:36.880459 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:36.880537 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:36.990446 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:36.990507 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:37.432705 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:37.432791 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:37.555457 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:37.555507 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:38.008566 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:38.008656 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:38.119511 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:38.119565 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:38.573570 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:38.573648 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:38.671444 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:38.671493 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:39.112598 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:39.112685 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:39.235422 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:39.235468 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:39.677665 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:39.677765 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:39.799510 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:39.799567 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:40.229637 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:40.229724 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:40.364530 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:40.364590 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:40.805652 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:40.805739 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:40.928550 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:40.928602 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:41.382573 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:41.382657 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1

## Every attempt to paste failed up to this point. The following paste attempts were succesful.

D2023-01-15 05:21:41.517778 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:41.517865 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:41.872547 instance.cpp:890] KeyEvent: Key(Control+Control_L states=4) rawKey: Key(Control+Control_L states=20) origKey: Key(Control+Control_L states=20) Release:1
D2023-01-15 05:21:41.872603 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:45.827032 instance.cpp:890] KeyEvent: Key(Control_L states=0) rawKey: Key(Control_L states=16) origKey: Key(Control_L states=16) Release:0
D2023-01-15 05:21:45.827092 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:46.268687 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:46.268775 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:46.391919 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:46.391985 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:46.881693 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:46.881780 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:46.993140 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:46.993185 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:47.433678 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:0
D2023-01-15 05:21:47.433744 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
D2023-01-15 05:21:47.544827 instance.cpp:890] KeyEvent: Key(Control+V states=4) rawKey: Key(Control+v states=20) origKey: Key(Control+v states=20) Release:1
D2023-01-15 05:21:47.544884 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:48.132750 instance.cpp:890] KeyEvent: Key(Control+Control_L states=4) rawKey: Key(Control+Control_L states=20) origKey: Key(Control+Control_L states=20) Release:1
D2023-01-15 05:21:48.132806 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:53.295791 instance.cpp:890] KeyEvent: Key(Control_L states=0) rawKey: Key(Control_L states=16) origKey: Key(Control_L states=16) Release:0
D2023-01-15 05:21:53.295843 inputcontext.cpp:275] KeyEvent handling time: 0ms result:0
D2023-01-15 05:21:53.479665 instance.cpp:890] KeyEvent: Key(Control+C states=4) rawKey: Key(Control+c states=20) origKey: Key(Control+c states=20) Release:0
D2023-01-15 05:21:53.479735 inputcontext.cpp:275] KeyEvent handling time: 0ms result:1
^C=========================
Fcitx 5.0.21 -- Get Signal No.: 2
Date: try "date -d @1673752913" if you are using GNU date ***
ProcessID: 21852
fcitx5(+0x12cbe)[0x55b59c487cbe]
/usr/lib/libc.so.6(+0x38a00)[0x7f3840c51a00]
/usr/lib/libc.so.6(epoll_wait+0x56)[0x7f3840d21096]
/usr/lib/libsystemd.so.0(sd_event_wait+0x1a8)[0x7f38410fed78]
/usr/lib/libsystemd.so.0(sd_event_run+0x1ac)[0x7f384110002c]
/usr/lib/libsystemd.so.0(sd_event_loop+0x60)[0x7f3841100170]
/usr/lib/libFcitx5Utils.so.2(_ZN5fcitx9EventLoop4execEv+0x16)[0x7f3841248d46]
/usr/lib/libFcitx5Core.so.7(_ZN5fcitx8Instance4execEv+0x57)[0x7f384130d277]
fcitx5(+0x11050)[0x55b59c486050]
/usr/lib/libc.so.6(+0x23290)[0x7f3840c3c290]
/usr/lib/libc.so.6(__libc_start_main+0x8a)[0x7f3840c3c34a]
fcitx5(+0x12425)[0x55b59c487425]
I2023-01-15 05:21:53.488769 addonmanager.cpp:297] Unloading addon hangul
I2023-01-15 05:21:53.488924 addonmanager.cpp:297] Unloading addon notifications
I2023-01-15 05:21:53.488985 addonmanager.cpp:297] Unloading addon notificationitem
I2023-01-15 05:21:53.489047 addonmanager.cpp:297] Unloading addon classicui
I2023-01-15 05:21:53.489553 addonmanager.cpp:297] Unloading addon unicode
I2023-01-15 05:21:53.489572 addonmanager.cpp:297] Unloading addon waylandim
I2023-01-15 05:21:53.489588 addonmanager.cpp:297] Unloading addon clipboard
I2023-01-15 05:21:53.489606 addonmanager.cpp:297] Unloading addon fcitx4frontend
I2023-01-15 05:21:53.489663 addonmanager.cpp:297] Unloading addon dbusfrontend
I2023-01-15 05:21:53.489683 addonmanager.cpp:297] Unloading addon wayland
I2023-01-15 05:21:53.489696 addonmanager.cpp:297] Unloading addon xim
I2023-01-15 05:21:53.489743 addonmanager.cpp:297] Unloading addon ibusfrontend
I2023-01-15 05:21:53.493598 addonmanager.cpp:297] Unloading addon dbus
I2023-01-15 05:21:53.493669 addonmanager.cpp:297] Unloading addon keyboard
I2023-01-15 05:21:53.493801 addonmanager.cpp:297] Unloading addon imselector
I2023-01-15 05:21:53.493820 addonmanager.cpp:297] Unloading addon quickphrase
I2023-01-15 05:21:53.493987 addonmanager.cpp:297] Unloading addon xcb
I2023-01-15 05:21:53.493999 inputcontextmanager.cpp:358] All display connections are gone, exit now.
tgn-ff commented 1 year ago

This might affect only the browser, not the textareas of webpages. I'm not certain. The urlbar and the devtools are definitely affected. Also, Thunderbird (composing new e-mail) is affected.

wengxt commented 1 year ago

Can you try with the current stable version of fcitx5-gtk and fcitx5-git to see if your issue is resolved?

wengxt commented 1 year ago

The observation from the log is that almost all key press event go through the key filtered code path, which is not my intention. The reason I think is because of some recent changes keyboard engine that always send preedit update.

In most case, preedit is simply empty and shouldn't trigger the re-forward code path. The changes above try to check if the pending event satisfies the condition and hopefully move keys like "ctrl + v" to another code path that doesn't trigger the issue.

tgn-ff commented 1 year ago

Yes, this fixes the pasting issue, but it somewhat re-introduces the previous one. Specifically, what's described in https://github.com/fcitx/fcitx5-gtk/issues/22#issuecomment-1312527298. With a couple of differences. 1) Pressing Enter won't submit the query, but ANY key (except for Backspace) pressed afterwards, will. Eg. With hangul, you can type fk ENTER and this will not submit the query, but if you press eg. Ctrl, it will. 2) This seems to fail only once. Every other query, even in new windows, will succeed until a browser restart.

wengxt commented 1 year ago

@tgn-ff sorry I made a small mistake in the previous commit, can you check it again with https://github.com/fcitx/fcitx5/commit/13f7d4c7fbd0056438efbbf91e740525f65f1337 ? (just rebuild fcitx5-git should be fine)

tgn-ff commented 1 year ago

Yes, both issues seem to be resolved now. However, there is a slight, but noticeable (>~150ms), delay when submitting queries through the urlbar. You can, actually, see the two steps that take place: committing the syllable then submitting the query.

wengxt commented 1 year ago

@tgn-ff can you do a screen record demostrate the issue you describe in the last comment? I'm not sure what do you mean.

wengxt commented 1 year ago

Also, urlbar delay you described, is it new issue? or an existing issue?

wengxt commented 1 year ago

I feel it's all expected from what I saw in firefox.

  1. commit text
  2. triggers omni urlbar search in firefox, which could be slow, and seems it wants combobox to be shown first.
  3. firefox handles enter.

Firefox seems doesn't implement a "blindly launch the search in the background without updating UI". I believe it's firefox's job to optimize their workflow.

Chrome bar seems does much better on this. After commit text + enter it doesn't need to show the combobox. (feels like the combobox is implemented asynchronously)

There's an about:config option in firefox, which allows to search with uncommitted preedit: keepPanelOpenDuringImeComposition. It caused issue to input method in the past https://bugzilla.mozilla.org/show_bug.cgi?id=1693726, but seems to be fixed. You can give it a try though I don't see it improve anything on the speed on my side, the combobox doesn't show and hide though if you enables it.

tgn-ff commented 1 year ago

You may be right. In any case, the delay is not new and it affects other IMEs as well; I just noticed it now due to the extra attention I paid. I'll see if it's worth to file a bug against Firefox at some point. Thank you for the patch.