[gtk/wip/matthiasc/popup4: 15/76] label: Make default activation work in roots



commit 66e21a5bda358ea96a3a27b60e45a0c98dc62ec9
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 05f2c8c537..b808898c23 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -6203,31 +6203,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]