[gtk/wip/matthiasc/popup4: 11/93] widget: Make grabbing default work for roots



commit 44ab878d1cf3933ba28082d75810fae124f0d325
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 3 20:06:25 2019 -0500

    widget: Make grabbing default work for roots
    
    Use the GtkRoot api to make grabbing the default
    work in roots other than GtkWindow.

 gtk/gtkwidget.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d1527e8f35..ee9e3a9e39 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5649,17 +5649,10 @@ _gtk_widget_set_has_default (GtkWidget *widget,
 void
 gtk_widget_grab_default (GtkWidget *widget)
 {
-  GtkWidget *window;
-
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (gtk_widget_get_can_default (widget));
 
-  window = _gtk_widget_get_toplevel (widget);
-
-  if (window && _gtk_widget_is_toplevel (window))
-    gtk_window_set_default (GTK_WINDOW (window), widget);
-  else
-    g_warning (G_STRLOC ": widget not within a GtkWindow");
+  gtk_root_set_default (gtk_widget_get_root (widget), widget);
 }
 
 /**


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