[gtk/wip/matthiasc/focus2: 8/33] Move a check to gtk_window_set_focus



commit d835a31d72db917a5d926b3543323f21b45f8b7f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 2 11:40:09 2019 -0500

    Move a check to gtk_window_set_focus
    
    gtk_widget_grab_focus is just a wrapper for
    gtk_window_set_focus. We should do all the enforcement
    there.

 gtk/gtkwidget.c | 3 ---
 gtk/gtkwindow.c | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 84b5cdce71..291c0c66fb 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5332,9 +5332,6 @@ gtk_widget_grab_focus (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (!gtk_widget_is_sensitive (widget))
-    return;
-
   GTK_WIDGET_GET_CLASS (widget)->grab_focus (widget);
 }
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 87c3aa6927..575bc80f89 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7343,6 +7343,9 @@ static void
 gtk_window_real_set_focus (GtkWindow *window,
                           GtkWidget *focus)
 {
+  if (focus && !gtk_widget_is_sensitive (focus))
+    return;
+
   unset_focus_widget (window);
   set_focus_widget (window, focus);
 }


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