forked from AuroraMiddleware/gtk
inspector: Don't add controllers to non-window toplevels
That doesn't make sense in this context and breaks grabs.
This commit is contained in:
parent
64849426ae
commit
f6a79559e9
@ -801,6 +801,10 @@ on_hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "object-controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
return;
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "object-controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
|
@ -114,6 +114,10 @@ hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "prop-controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
return;
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "prop-controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
|
@ -481,6 +481,10 @@ on_hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "resource-controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
return;
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "resource-controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
|
@ -332,6 +332,10 @@ hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "statistics-controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
return;
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "statistics-controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
|
Loading…
Reference in New Issue
Block a user