Commit a97e3ffc authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko
Browse files

swipeable: Distinguish direct and indirect swipes



Add "direct" parameter to hdy_paginator_begin_swipe() and the corresponding
vfunc, providing a way to tell apart swipes started via HdySwipeGroup sync.
This will be used to have leaflet in headerbar that's not swipeable, but
can still animate along with leaflet in content area.
Signed-off-by: Alexander Mikhaylenko's avatarAlexander Mikhaylenko <alexm@gnome.org>
parent 254296fa
......@@ -119,7 +119,8 @@ hdy_paginator_switch_child (HdySwipeable *swipeable,
static void
hdy_paginator_begin_swipe (HdySwipeable *swipeable,
gint direction)
gint direction,
gboolean direct)
{
HdyPaginator *self = HDY_PAGINATOR (swipeable);
gdouble distance, position, closest_point;
......
......@@ -130,7 +130,7 @@ begin_swipe_cb (HdySwipeGroup *self,
for (swipeables = self->swipeables; swipeables != NULL; swipeables = swipeables->next)
if (swipeables->data != swipeable)
hdy_swipeable_begin_swipe (swipeables->data, direction);
hdy_swipeable_begin_swipe (swipeables->data, direction, FALSE);
}
static void
......
......@@ -146,7 +146,7 @@ gesture_prepare (HdySwipeTracker *self,
return;
self->state = HDY_SWIPE_TRACKER_STATE_PREPARING;
hdy_swipeable_begin_swipe (self->swipeable, direction);
hdy_swipeable_begin_swipe (self->swipeable, direction, TRUE);
}
static void
......
......@@ -15,7 +15,8 @@ void hdy_swipeable_switch_child (HdySwipeable *self,
guint index,
gint64 duration);
void hdy_swipeable_begin_swipe (HdySwipeable *self,
gint direction);
gint direction,
gboolean direct);
void hdy_swipeable_update_swipe (HdySwipeable *self,
gdouble value);
void hdy_swipeable_end_swipe (HdySwipeable *self,
......
......@@ -151,18 +151,25 @@ hdy_swipeable_switch_child (HdySwipeable *self,
* hdy_swipeable_begin_swipe:
* @self: a #HdySwipeable
* @direction: The direction of the swipe, can be 1 or -1
* @direct: %TRUE if the swipe is directly triggered by a gesture,
* %FALSE if it's triggered via a #HdySwipeGroup
*
* This function is called by #HdySwipeTracker when a possible swipe is detected.
* The implementation should check whether a swipe is possible, and if it is,
* it must call hdy_swipe_tracker_confirm_swipe() to provide details about the
* swipe, see that function for details.
* The @direction value can be used to restrict the swipe to a certain direction.
*
* The @direct parameter can be used to have widgets that aren't swipeable, but
* can still animate in sync with other widgets in a #HdySwipeGroup by only
* applying restrictions if @direct is %TRUE.
*
* Since: 0.0.12
*/
void
hdy_swipeable_begin_swipe (HdySwipeable *self,
gint direction)
gint direction,
gboolean direct)
{
HdySwipeableInterface *iface;
......@@ -171,7 +178,7 @@ hdy_swipeable_begin_swipe (HdySwipeable *self,
iface = HDY_SWIPEABLE_GET_IFACE (self);
g_return_if_fail (iface->begin_swipe != NULL);
(* iface->begin_swipe) (self, direction);
(* iface->begin_swipe) (self, direction, direct);
g_signal_emit (self, signals[SIGNAL_BEGIN_SWIPE], 0, direction);
}
......
......@@ -34,7 +34,8 @@ struct _HdySwipeableInterface
guint index,
gint64 duration);
void (*begin_swipe) (HdySwipeable *self,
gint direction);
gint direction,
gboolean direct);
void (*update_swipe) (HdySwipeable *self,
gdouble value);
void (*end_swipe) (HdySwipeable *self,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment