[gtk/wip/matthiasc/popup: 52/63] widget: Make grabbing default work for roots



commit 1743dd8f607daef376bfb235cab08d3507ad6f4b
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 ba2db56f5d..42900b938c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5740,17 +5740,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]