From 8af0782261aed47f3084f24dec4fcf7c32df6dc7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 7 Apr 2019 12:16:20 +0000 Subject: [PATCH] treeview: Make expanders work again These were broken by the crossing event unification. We are now generating some more crossing events, and the treeview was not looking closely enough at the ones it gets. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1814 --- gtk/gtktreeview.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index a1eda1d11b..19c085a1c1 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -5472,15 +5472,21 @@ gtk_tree_view_motion_controller_leave (GtkEventControllerMotion *controller, GdkNotifyType detail, GtkTreeView *tree_view) { + gboolean is_focus, contains_focus; + if (tree_view->priv->prelight_node) gtk_widget_queue_draw (GTK_WIDGET (tree_view)); tree_view->priv->event_last_x = -10000; tree_view->priv->event_last_y = -10000; - prelight_or_select (tree_view, - NULL, NULL, - -1000, -1000); /* coords not possibly over an arrow */ + g_object_get (controller, + "is-pointer-focus", &is_focus, + "contains-pointer-focus", &contains_focus, + NULL); + + if (!is_focus && !contains_focus) + prelight_or_select (tree_view, NULL, NULL, -1000, -1000); /* not possibly over an arrow */ } static void @@ -5489,10 +5495,18 @@ gtk_tree_view_key_controller_focus_out (GtkEventControllerKey *key, GdkNotifyType detail, GtkTreeView *tree_view) { + gboolean is_focus, contains_focus; + gtk_widget_queue_draw (GTK_WIDGET (tree_view)); + g_object_get (key, + "is-focus", &is_focus, + "contains-focus", &contains_focus, + NULL); + /* destroy interactive search dialog */ - if (tree_view->priv->search_window) + if (tree_view->priv->search_window && + !is_focus && !contains_focus) gtk_tree_view_search_window_hide (tree_view->priv->search_window, tree_view, gtk_get_current_event_device ()); }