Skip to content

input-method-relay: send text-input-v3 enter on focus regardless of enable state - #3256

Open
fpemud wants to merge 1 commit into
WayfireWM:masterfrom
fpemud:fix-input-method-v2-enter
Open

fpemud wants to merge 1 commit into
WayfireWM:masterfrom
fpemud:fix-input-method-v2-enter

Conversation

@fpemud

@fpemud fpemud commented Nov 29, 2026

Copy link
Copy Markdown

Problem

I'm using a pure text-input-v3 and input-method-v2 configuration.
The compositor (wayfire), the input method (fcitx) and all the applications I'm using are all advertising only these two protocol versions.

The problem I encounter is that for nearly all applications, the input method never activates.

AI analysis identified the root cause: clients that create their zwp_text_input_v3 object before their surface gains keyboard focus never enable text input.

Example applications affected: featherpad, chromium, kitty.

Detailed Cause Analysis

input_method_relay::set_focus() skips text inputs that are not yet enabled:

if (!text_input->input->current_enabled)
{
    continue;
}

Per text-input-unstable-v3, enable requests text input "on the surface previously obtained from the enter event" — the client enables after it receives enter. The only other enter path is on_text_input_new, which only fires when the surface is already focused at that moment (#2113). So a text input created before focus is never entered and never enabled.

Reproduction

WAYLAND_DEBUG=1 featherpad (or chromium/kitty) with fcitx5 running:

-> zwp_text_input_v3#18.commit()
-> zwp_text_input_v3#18.commit()

No enter from the compositor, no enable() from the client, fcitx5's InputContext stays focus:0.

Fix

Send enter to the focused surface's text input on focus change regardless of current_enabled. The client then enables itself; on_text_input_enable activates the input method. This complements the #2113 case (text input created after focus).

I don't quite understand the code change, but after this patch, all my applications are able to use fcitx with Ctrl+Space. I haven't found any side effects so far.

I am willing to test on my system (Gentoo) whether this patch introduces any other problems.

…nable state

set_focus() currently skips text inputs that are not enabled yet. However,
per the text-input-unstable-v3 protocol a client enables text input only
after it receives the enter event ("requests text input on the surface
previously obtained from the enter event"). The only other path that sends
enter is on_text_input_new, and only when the surface is already focused at
that moment (WayfireWM#2113), so a text input created before the surface gains focus
is never entered and never enabled.

This breaks clients that create their zwp_text_input_v3 before focus (Qt apps
such as Featherpad, Chromium, kitty): the input method (e.g. fcitx5) never
activates and stays at focus:0.

Send enter to the focused surface's text input on focus change regardless of
current_enabled; the client then enables itself and on_text_input_enable
activates the input method. This complements the WayfireWM#2113 case.
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

Successfully merging this pull request may close these issues.

1 participant