[gtk] window: tie focus to surface state changes



commit 1f8e633fff233883afeeb6a0452967ae163250e7
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Apr 2 17:21:01 2020 -0400

    window: tie focus to surface state changes
    
    We don't get a focus-out on the event controller, when
    the surface is losing keyboard focus, since we are not
    moving our focus to some other widget, so we are never
    unsetting the mnemonics-visible property. Do that in
    response to surface state changes instead.

 gtk/gtkwindow.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index d57810aa43..204f34d4be 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5088,7 +5088,16 @@ surface_state_changed (GtkWidget *widget)
   priv->state = new_surface_state;
 
   if (changed_mask & GDK_SURFACE_STATE_FOCUSED)
-    ensure_state_flag_backdrop (widget);
+    {
+      gboolean focused = new_surface_state & GDK_SURFACE_STATE_FOCUSED;
+
+      ensure_state_flag_backdrop (widget);
+
+      _gtk_window_set_is_active (window, focused);
+
+      if (!focused)
+        gtk_window_set_mnemonics_visible (window, FALSE);
+    }
 
   if (changed_mask & GDK_SURFACE_STATE_FULLSCREEN)
     {


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