[gtk+] scrolling: interpret smooth deltas as pixels on quartz
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scrolling: interpret smooth deltas as pixels on quartz
- Date: Fri, 5 Sep 2014 12:03:24 +0000 (UTC)
commit 3fa425bb9cc3114559de09f25e57ff759bc5b531
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Fri Sep 5 13:38:30 2014 +0200
scrolling: interpret smooth deltas as pixels on quartz
This is a temporary workaround for scrolling units being amplified
on quartz, due to the assumption that smooth scrolling deltas are
always in some abstract unit similar to the one from xi2.
A proper solution for the situation is described in bug #736121, but
since we are close to release, this patch solves the issue temporarily.
https://bugzilla.gnome.org/show_bug.cgi?id=736121
gtk/gtkrange.c | 4 ++++
gtk/gtkscrolledwindow.c | 10 ++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 13f6887..309f43c 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2806,6 +2806,10 @@ _gtk_range_get_wheel_delta (GtkRange *range,
if (gdk_event_get_scroll_deltas ((GdkEvent *) event, &dx, &dy))
{
+#ifdef GDK_WINDOWING_QUARTZ
+ scroll_unit = 1;
+#endif
+
if (dx != 0 &&
gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
delta = dx * scroll_unit;
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 79f8cd8..464d14f 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2425,7 +2425,12 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
adj = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
page_size = gtk_adjustment_get_page_size (adj);
+
+#ifdef GDK_WINDOWING_QUARTZ
+ scroll_unit = 1;
+#else
scroll_unit = pow (page_size, 2.0 / 3.0);
+#endif
new_value = CLAMP (gtk_adjustment_get_value (adj) + delta_x * scroll_unit,
gtk_adjustment_get_lower (adj),
@@ -2447,7 +2452,12 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
adj = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
page_size = gtk_adjustment_get_page_size (adj);
+
+#ifdef GDK_WINDOWING_QUARTZ
+ scroll_unit = 1;
+#else
scroll_unit = pow (page_size, 2.0 / 3.0);
+#endif
new_value = CLAMP (gtk_adjustment_get_value (adj) + delta_y * scroll_unit,
gtk_adjustment_get_lower (adj),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]