Merge branch 'wip/corey/column-view-header' into 'main'

columnviewtitle: Prevent header clicks from propagating

Closes #5425

See merge request GNOME/gtk!5306
This commit is contained in:
Matthias Clasen 2022-12-09 15:28:58 +00:00
commit abe5181b10

View File

@ -250,6 +250,18 @@ click_released_cb (GtkGestureClick *gesture,
show_menu (self, x, y);
}
static void
click_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,
GtkColumnView *self)
{
/* Claim the state here to prevent propagation, the event controllers in
* GtkColumView have already been handled in the CAPTURE phase */
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
gtk_column_view_title_init (GtkColumnViewTitle *self)
{
@ -272,6 +284,7 @@ gtk_column_view_title_init (GtkColumnViewTitle *self)
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "released", G_CALLBACK (click_released_cb), self);
g_signal_connect (gesture, "pressed", G_CALLBACK (click_pressed_cb), self);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
}