[gtk/wip/exalm/activate] listitemwidget: Activate on release instead of press




commit 3bdd7166aa0c77db3bd05fd10ac5c7431b24a80d
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Dec 28 19:41:30 2020 +0500

    listitemwidget: Activate on release instead of press
    
    Single click activation should only be done on release and not on press,
    otherwise it breaks touch scrolling. Double-click activation still can be
    done on press.
    
    This matches the GtkListBox behavior as well.

 gtk/gtklistitemwidget.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtklistitemwidget.c b/gtk/gtklistitemwidget.c
index abe6352688..e844ac1622 100644
--- a/gtk/gtklistitemwidget.c
+++ b/gtk/gtklistitemwidget.c
@@ -332,7 +332,7 @@ gtk_list_item_widget_click_gesture_pressed (GtkGestureClick   *gesture,
 
   if (!priv->list_item || priv->list_item->activatable)
     {
-      if (n_press == 2 || priv->single_click_activate)
+      if (n_press == 2)
         {
           gtk_widget_activate_action (GTK_WIDGET (self),
                                       "list.activate-item",
@@ -356,6 +356,16 @@ gtk_list_item_widget_click_gesture_released (GtkGestureClick   *gesture,
 {
   GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
 
+  if (priv->single_click_activate)
+    {
+      gtk_widget_activate_action (GTK_WIDGET (self),
+                                  "list.activate-item",
+                                  "u",
+                                  priv->position);
+
+      return;
+    }
+
   if (!priv->list_item || priv->list_item->selectable)
     {
       GdkModifierType state;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]