[gtk/wip/matthiasc/focus2: 35/41] root: Don't allow setting nonsense focus



commit 0141c0fae8f2561ee685a7f037d5ebbb92488120
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 4 20:31:20 2019 -0500

    root: Don't allow setting nonsense focus
    
    Don't allow setting focus-widget to something
    thats not inside the root.

 gtk/gtkroot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkroot.c b/gtk/gtkroot.c
index 249d7405b1..3ed7812856 100644
--- a/gtk/gtkroot.c
+++ b/gtk/gtkroot.c
@@ -152,7 +152,8 @@ gtk_root_set_focus (GtkRoot   *self,
                     GtkWidget *focus)
 {
   g_return_if_fail (GTK_IS_ROOT (self));
-  g_return_if_fail (focus == NULL || GTK_IS_WIDGET (focus));
+  g_return_if_fail (focus == NULL ||
+                    (GTK_IS_WIDGET (focus) && gtk_widget_get_root (focus) == self));
 
   g_object_set (self, "focus-widget", focus, NULL);
 }


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