[gtk/wip/matthiasc/popup2: 50/126] text: Make default activation work in roots



commit 37e984a9413edfb35114745f1b99c89488f0c61c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 3 20:02:12 2019 -0500

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

 gtk/gtktext.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 7a4d6cc2b9..fb9c7fb244 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3793,30 +3793,9 @@ static void
 gtk_text_real_activate (GtkText *self)
 {
   GtkTextPrivate *priv = gtk_text_get_instance_private (self);
-  GtkWindow *window;
-  GtkWidget *default_widget, *focus_widget;
-  GtkWidget *toplevel;
-  GtkWidget *widget;
-
-  widget = GTK_WIDGET (self);
 
   if (priv->activates_default)
-    {
-      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 (widget != default_widget &&
-                  !(widget == focus_widget && (!default_widget || !gtk_widget_get_sensitive 
(default_widget))))
-                gtk_window_activate_default (window);
-            }
-        }
-    }
+    gtk_root_activate_default (gtk_widget_get_root (GTK_WIDGET (self)));
 }
 
 static void


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