[gtk: 1/2] gtkimcontextwayland: Save context even when text_input isn't around yet




commit 45397534eb5cc12e8c353ddd18a888e21c91f8d9
Author: Guido Günther <agx sigxcpu org>
Date:   Tue Jan 18 14:22:24 2022 +0100

    gtkimcontextwayland: Save context even when text_input isn't around yet
    
    Remember the current context on focus-in even though the text-input
    isn't set up yet. This helps in the case where the text-input is not yet
    created but a widget already got focused. Without that the enable()
    invocation in text_input_enter() woulnd't be invoked leaving the input
    method disabled.
    
    This fixes
    
        gtk4-demo --run=search_entry
    
    which would initially not show the on-screen keyboard when e.g using
    phoc/sway as compositor.

 gtk/gtkimcontextwayland.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 8b372d048f..60e1e466bf 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -794,12 +794,13 @@ gtk_im_context_wayland_focus_in (GtkIMContext *context)
   global = gtk_im_context_wayland_global_get (gtk_widget_get_display (self->widget));
   if (global->current == context)
     return;
+
+  global->current = context;
   if (!global->text_input)
     return;
 
   if (self->gesture)
     gtk_event_controller_reset (GTK_EVENT_CONTROLLER (self->gesture));
-  global->current = context;
 
   if (global->focused)
     enable (self, global);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]