[gtk+] listbox: Handle unpaired releases as well
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] listbox: Handle unpaired releases as well
- Date: Mon, 27 Nov 2017 00:52:47 +0000 (UTC)
commit 268ebb3a46ada5bcd6731e8028b3302434e0ce8f
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Nov 26 19:52:01 2017 -0500
listbox: Handle unpaired releases as well
Same as for flowbox in the previous commit.
gtk/gtklistbox.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 97a98d0..4a8f244 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -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);
}
@@ -1774,6 +1781,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,
gdouble x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]