Currently when the widget is realized after the focus in event the input method isn't activated as enable is never sent. The call trace is
gtk_text_focus_changed -> gtk_im_context_focus_in -> gtk_im_context_wayland_focus_in
which returns early as self->widget is NULL since it's set up in
gtk_im_context_set_client_widget(). Handle that
case by invoking
A case where the above happens is a
GtkSearchEntry in a
E.g. in gtk4-demo when starting the demo and then hitting the search
button right away.
@carlosg This is what we could do in
GText to fix the second half of !4397 (merged).
Alternatives would be moving this to
GtkIMContextWayland which looks worse as it would be wayland specific. Also I don't think we can mandate that
is-focus change happen after
realize (which would make this problem go away entirely)- the revealer case shows those two events can be quite decoupled but I'd be happy to be wrong.
GtkTextView would likely need a similar change