[gtk/wip/matthiasc/popup4: 11/57] text: Make default activation work in roots



commit 52acfec08c8a8acd7a34a891916b1a898b22ea7b
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 f93293a342..143a310013 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3839,30 +3839,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]