[gtk+/wip/matthiasc/visible-focus: 1/3] Set the new state flag



commit 73e23d98f4ae07616e71dcbb38d7fe6cbba9169b
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 28 22:25:06 2017 -0400

    Set the new state flag
    
    For now, we only set the new visible focus state
    on the focus widget, when we have visible focus.
    Later on, we will allow setting it on other widgets.

 gtk/gtkwindow.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a6b64d8..eb631f4 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7747,7 +7747,10 @@ gtk_window_real_set_focus (GtkWindow *window,
       priv->focus_widget = NULL;
 
       if (priv->is_active)
-       do_focus_change (old_focus, FALSE);
+        {
+         do_focus_change (old_focus, FALSE);
+          gtk_widget_unset_state_flags (old_focus, GTK_STATE_FLAG_FOCUS_VISIBLE);
+        }
 
       g_object_notify (G_OBJECT (old_focus), "is-focus");
     }
@@ -7770,7 +7773,11 @@ gtk_window_real_set_focus (GtkWindow *window,
        }
 
       if (priv->is_active)
-       do_focus_change (priv->focus_widget, TRUE);
+        {
+         do_focus_change (priv->focus_widget, TRUE);
+          if (priv->focus_visible)
+            gtk_widget_set_state_flags (priv->focus_widget, GTK_STATE_FLAG_FOCUS_VISIBLE, FALSE);
+        }
 
       /* It's possible for do_focus_change() above to have callbacks
        * that clear priv->focus_widget here.


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