listbox: Handle unpaired releases as well

Same as for flowbox in the previous commit.
This commit is contained in:
Matthias Clasen 2017-11-26 19:52:01 -05:00
parent 0567b41f24
commit 268ebb3a46

View File

@ -243,6 +243,12 @@ static void gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gest
gdouble x,
gdouble y,
GtkListBox *box);
static void gtk_list_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
gdouble x,
gdouble y,
guint button,
GdkEventSequence *sequence,
GtkListBox *box);
static void gtk_list_box_multipress_gesture_stopped (GtkGestureMultiPress *gesture,
GtkListBox *box);
@ -603,7 +609,8 @@ gtk_list_box_init (GtkListBox *box)
G_CALLBACK (gtk_list_box_multipress_gesture_released), box);
g_signal_connect (priv->multipress_gesture, "stopped",
G_CALLBACK (gtk_list_box_multipress_gesture_stopped), box);
g_signal_connect (priv->multipress_gesture, "unpaired-released",
G_CALLBACK (gtk_list_box_multipress_unpaired_release), box);
g_signal_connect (box, "notify::parent", G_CALLBACK (gtk_list_box_parent_cb), NULL);
}
@ -1773,6 +1780,26 @@ get_current_selection_modifiers (GtkWidget *widget,
}
}
static void
gtk_list_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
gdouble x,
gdouble y,
guint button,
GdkEventSequence *sequence,
GtkListBox *box)
{
GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRow *row;
if (!priv->activate_single_click)
return;
row = gtk_list_box_get_row_at_y (box, y);
if (row)
gtk_list_box_select_and_activate (box, row);
}
static void
gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
guint n_press,