Tab key does not reach input method when using gnome-text-editor with GTK_IM_MODULE=ibus
Steps to reproduce
The original report is https://bugzilla.redhat.com/show_bug.cgi?id=2098250
- GTK_IM_MDOULE=ibus set in the environment
- Start gnome-text-editor
- Enable ibus-anthy
- When using ibus-anthy, type “a” to get a hiragana “あ”
- Type space to convert to kanji, the preedit shows “唖” (or another kanji with that pronunciation)
- Type space again to open the candidate list and show the second candidate
- Type Tab to select the next (3rd) candidate)
Current behavior
gnome-text-editor inserts Tab char and move the preedit next to the Tab char.
Expected outcome
Candidate list moves the selected candidate to the next.
Version information
gtk4-4.10.3-1.fc38.x86_64 gtksourceview5-5.8.0-1.fc38.x86_64 ibus-1.5.28-3.fc38.x86_64
Additional information
This issue does not happen in case of GTK_IM_MODULE=wayland because gnome-shell/mutter handles the input methods instead of GTK4.
I confirmed this issue is can be fixed if I delete gtk_event_controller_set_propagation_phase (key, GTK_PHASE_CAPTURE)
in gtksourceview/gtksourceview/gtksourceview.c:gtk_source_view_init() and add gtk_event_controller_set_propagation_phase (priv->key_controller, GTK_PHASE_CAPTURE)
in gtk/gtk/gtktextview.c:gtk_text_view_init()
I think GtkTextView's GtkEventControllerKey needs to receive the events before GtkSourceView's one for the input methods but seems GtkPropagationPhase does not provide so many options.
I think the key event order is 1. Window Manager, 2. Input Method, 3. Application and that's why IBus has been used gtk_key_snooper_install() in GTK3.