[gtk/wip/otte/matthiasc/popup2: 17/92] label: Make default activation work in roots



commit 2cfadf790c53c723e43077359b67fac541e433e5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 3 20:10:06 2019 -0500

    label: Make default activation work in roots
    
    Use the GtkRoot API when activating the default widget.
    This makes things work in GtkWindow and GtkPopup.

 gtk/gtklabel.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 859fa5059a..522a2197a2 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -6209,31 +6209,9 @@ gtk_label_activate_current_link (GtkLabel *label)
   link = gtk_label_get_focus_link (label);
 
   if (link)
-    {
-      emit_activate_link (label, link);
-    }
+    emit_activate_link (label, link);
   else
-    {
-      GtkWidget *toplevel;
-      GtkWindow *window;
-      GtkWidget *default_widget, *focus_widget;
-
-      toplevel = gtk_widget_get_toplevel (widget);
-      if (GTK_IS_WINDOW (toplevel))
-        {
-          window = GTK_WINDOW (toplevel);
-
-          if (window)
-            {
-              default_widget = gtk_window_get_default_widget (window);
-              focus_widget = gtk_root_get_focus (GTK_ROOT (window));
-
-              if (default_widget != widget &&
-                  !(widget == focus_widget && (!default_widget || !gtk_widget_is_sensitive 
(default_widget))))
-                gtk_window_activate_default (window);
-            }
-        }
-    }
+    gtk_root_activate_default (gtk_widget_get_root (widget));
 }
 
 static GtkLabelLink *


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