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:
Timm Bäder 2018-05-05 09:06:22 +02:00
parent 64849426ae
commit f6a79559e9
4 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);