[gtk: 4/7] gtkrange: Add scroll unit handling
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 4/7] gtkrange: Add scroll unit handling
- Date: Sat, 19 Mar 2022 00:47:11 +0000 (UTC)
commit f9e2c106bc24865fae7f5b6c73f0a533bc298b88
Author: panoplie <59100-panoplie users noreply gitlab gnome org>
Date: Mon Feb 28 21:45:06 2022 +0100
gtkrange: Add scroll unit handling
gtk/gtkrange.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index c3c270e6c3..f185ab6763 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2202,25 +2202,27 @@ gtk_range_scroll_controller_scroll (GtkEventControllerScroll *scroll,
GtkRange *range)
{
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
- double scroll_unit, delta;
+ double delta;
gboolean handled;
GtkOrientation move_orientation;
-
-#ifdef GDK_WINDOWING_MACOS
- scroll_unit = 1;
-#else
- scroll_unit = gtk_adjustment_get_page_increment (priv->adjustment);
-#endif
+ GdkScrollUnit scroll_unit;
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL && dx != 0)
{
move_orientation = GTK_ORIENTATION_HORIZONTAL;
- delta = dx * scroll_unit;
+ delta = dx;
}
else
{
move_orientation = GTK_ORIENTATION_VERTICAL;
- delta = dy * scroll_unit;
+ delta = dy;
+ }
+
+ scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
+
+ if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
+ {
+ delta *= gtk_adjustment_get_page_increment (priv->adjustment);
}
if (delta != 0 && should_invert_move (range, move_orientation))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]