Skip to content

input_method: send unavailable to the newcomer - #2198

Merged
Drakulix merged 1 commit into
Smithay:masterfrom
ezemtsov:input-method-single-instance
Oct 6, 2026
Merged

Drakulix merged 1 commit into
Smithay:masterfrom
ezemtsov:input-method-single-instance

Conversation

@ezemtsov

@ezemtsov ezemtsov commented Oct 6, 2026

Copy link
Copy Markdown

Hi!

I'm the author of ewm, an emacs driven compositor which is based on smithay. Lately I was looking into adding generic support for external input methods (in addition to emacs which already works), so that e.g. ewm would start supporting fcitx5 etc. And while testing it I found a bug related to input_method_v2 protocol implementation in smithay.

In ewm, emacs as input method is enabled by default, and its zwp_input_method_v2 object is the seat's tracked instance. When a user starts another program (e.g. fcitx5), it calls get_input_method on the same seat. Currently in add_instance, Smithay emits unavailable on the original instance (emacs) and leaves fcitx5's new object untracked. This breaks the original input method while leaving fcitx5 with no follow up.

Instead, per protocol the compositor should emit unavailable on the new input method (fcitx5), and the original connected input method (emacs) instance stays and keeps receiving activate/deactivate.

Here's an example of a correct behavior in Sway, keeping the existing instance and sending unavailable to the newcomer:

  if (relay->input_method != NULL) {
      sway_log(SWAY_INFO, "Attempted to connect second input method to a seat");
      wlr_input_method_v2_send_unavailable(input_method);
      return;
  }

The protocol original description: here

Checklist

…ance

The protocol allows one input method per seat and requires a second one to be
the object that receives unavailable, leaving the first in place. add_instance
did the reverse: it sent unavailable to the existing instance and dropped the
newcomer untracked. destroyed also cleared the seat for any instance, so an
inert newcomer exiting evicted the live one, and an inert newcomer's requests
still drove the seat's text input.

@Drakulix Drakulix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible, thanks!

@Drakulix
Drakulix merged commit 904d3bd into Smithay:master Oct 6, 2026
14 checks passed
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.

2 participants