[libhandy] swipe-tracker: Make button workaround less strict



commit b146c2264d4cfaf71451939182d714716b764180
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Fri Nov 6 18:54:56 2020 +0500

    swipe-tracker: Make button workaround less strict
    
    Allow nested swipeable widgets if their orientation differs.
    
    This should help with https://source.puri.sm/Librem5/phosh/-/issues/205

 src/hdy-swipe-tracker.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-swipe-tracker.c b/src/hdy-swipe-tracker.c
index 0646f1c0..816b81ae 100644
--- a/src/hdy-swipe-tracker.c
+++ b/src/hdy-swipe-tracker.c
@@ -547,6 +547,23 @@ is_window_handle (GtkWidget *widget)
   return parent == titlebar;
 }
 
+static gboolean
+has_conflicts (HdySwipeTracker *self,
+               GtkWidget       *widget)
+{
+  HdySwipeTracker *other;
+
+  if (widget == GTK_WIDGET (self->swipeable))
+    return TRUE;
+
+  if (!HDY_IS_SWIPEABLE (widget))
+    return FALSE;
+
+  other = hdy_swipeable_get_swipe_tracker (HDY_SWIPEABLE (widget));
+
+  return self->orientation == other->orientation;
+}
+
 /* HACK: Since we don't have _gtk_widget_consumes_motion(), we can't do a proper
  * check for whether we can drag from a widget or not. So we trust the widgets
  * to propagate or stop their events. However, GtkButton stops press events,
@@ -562,7 +579,7 @@ should_force_drag (HdySwipeTracker *self,
     return FALSE;
 
   parent = widget;
-  while (parent && !HDY_IS_SWIPEABLE (parent))
+  while (parent && !has_conflicts (self, parent))
     parent = gtk_widget_get_parent (parent);
 
   return parent == GTK_WIDGET (self->swipeable);


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