As far as I can tell there's no guarantee that the text_input
global is already set up
when gtkimcontextwayland
sees gtk_im_context_wayland_focus_in
from gtk. In that
case when text_input
is finally created we fail to send enable()
in text_input_enter ()
since we don't have a valid context (thus e.g. the onscreen-keyboard is not shown). To fix this, this MR does two things:
- remember the current context even though text_input isn't set up. This fixes the case where on application startup a search entry has focus like
gtk4-demo --run=search_entry
- remember the current context even when the passed in widget is NULL. This fixes the case where the search entry is hidden (like the search entry in gtk4-demo):
gtk4-demo # then press the search button
This is can be reproduced with compositors like sway or phoc. Note that this only applies to the initial focus, as soon as when e.g. presses tab
to move the focus and then shift-tab
to move it back the osk unfolds since there's a new focus-in
from GTK which sets up the context.