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
This commit is contained in:
Jesse van den Kieboom
2014-09-05 13:38:30 +02:00
parent fb3019a946
commit 3fa425bb9c
2 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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),