list: Remove active state handling in listitemwidget and treeexpander

Active state is handled by main now.  It appears that listitem and
treeexpander handled it manually (probably before main did).  This
is unnecessary now, so let's remove it.
This commit is contained in:
Corey Berla 2022-11-30 10:48:14 -08:00
parent fdfd76774e
commit c541de3e05
2 changed files with 4 additions and 49 deletions

View File

@ -443,8 +443,6 @@ gtk_list_item_widget_click_gesture_pressed (GtkGestureClick *gesture,
}
}
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_ACTIVE, FALSE);
if (gtk_widget_get_focus_on_click (widget))
gtk_widget_grab_focus (widget);
}
@ -488,8 +486,6 @@ gtk_list_item_widget_click_gesture_released (GtkGestureClick *gesture,
"(ubb)",
priv->position, modify, extend);
}
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_ACTIVE);
}
static void
@ -525,14 +521,6 @@ gtk_list_item_widget_hover_cb (GtkEventControllerMotion *controller,
}
}
static void
gtk_list_item_widget_click_gesture_canceled (GtkGestureClick *gesture,
GdkEventSequence *sequence,
GtkListItemWidget *self)
{
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_ACTIVE);
}
static void
gtk_list_item_widget_init (GtkListItemWidget *self)
{
@ -552,8 +540,6 @@ gtk_list_item_widget_init (GtkListItemWidget *self)
G_CALLBACK (gtk_list_item_widget_click_gesture_pressed), self);
g_signal_connect (gesture, "released",
G_CALLBACK (gtk_list_item_widget_click_gesture_released), self);
g_signal_connect (gesture, "cancel",
G_CALLBACK (gtk_list_item_widget_click_gesture_canceled), self);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
controller = gtk_event_controller_focus_new ();

View File

@ -118,21 +118,6 @@ G_DEFINE_TYPE (GtkTreeExpander, gtk_tree_expander, GTK_TYPE_WIDGET)
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
gtk_tree_expander_click_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
gpointer unused)
{
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
gtk_widget_set_state_flags (widget,
GTK_STATE_FLAG_ACTIVE,
FALSE);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
gtk_tree_expander_click_gesture_released (GtkGestureClick *gesture,
@ -143,23 +128,11 @@ gtk_tree_expander_click_gesture_released (GtkGestureClick *gesture,
{
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);
}
static void
gtk_tree_expander_click_gesture_cancelled (GtkGesture *gesture,
GdkEventSequence *sequence,
gpointer unused)
{
gtk_widget_unset_state_flags (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
GTK_STATE_FLAG_ACTIVE);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
{
gtk_widget_activate_action (widget, "listitem.toggle-expand", NULL);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
}
static void
@ -204,12 +177,8 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
FALSE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
GDK_BUTTON_PRIMARY);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_tree_expander_click_gesture_pressed), NULL);
g_signal_connect (gesture, "released",
G_CALLBACK (gtk_tree_expander_click_gesture_released), NULL);
g_signal_connect (gesture, "cancel",
G_CALLBACK (gtk_tree_expander_click_gesture_cancelled), NULL);
gtk_widget_add_controller (self->expander_icon, GTK_EVENT_CONTROLLER (gesture));
gtk_widget_insert_before (self->expander_icon,