treeexpander: Toggle expand on release instead of pressed

With the introduction of the hide-expander property, I noticed that
the active state would persist in many cases because the release
signal was never emitted.  In gtk3 tree expanders, expanded
on release.  gtk4 expanded on press to match window explorer.
Per irc chat, the designers didn't have a strong preference
for press or release.  In order to keep consistency and
fix this bug, let's move back to release.
This commit is contained in:
Corey Berla 2022-11-29 14:58:29 -08:00
parent 63a655e345
commit 847b3261fc

View File

@ -127,8 +127,6 @@ gtk_tree_expander_click_gesture_pressed (GtkGestureClick *gesture,
{
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
gtk_widget_activate_action (widget, "listitem.toggle-expand", NULL);
gtk_widget_set_state_flags (widget,
GTK_STATE_FLAG_ACTIVE,
FALSE);
@ -143,8 +141,12 @@ gtk_tree_expander_click_gesture_released (GtkGestureClick *gesture,
double y,
gpointer unused)
{
gtk_widget_unset_state_flags (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
GTK_STATE_FLAG_ACTIVE);
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_ACTIVE);
if (gtk_widget_contains (widget, x, y))
gtk_widget_activate_action (widget, "listitem.toggle-expand", NULL);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}