From 700c06023ee8409ae57458c3ecf77842e9553171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 20 Mar 2012 00:19:08 +0100 Subject: [PATCH] st: Clean up scroll event code Currently the scroll event code only handles scroll events if the adjustment's value is within the "lower" and "upper" limits. The likely intent was to pass events to a parent scroll view when reaching the bounds (uh, nested scroll views!), but apparently we never made use of this, as the upper bound is actually wrong (an adjustment's maximum value is upper - page_size, not upper). Just handle all scroll events unconditionally and rely on the bound checks in StAdjustment. https://bugzilla.gnome.org/show_bug.cgi?id=672413 --- src/st/st-scroll-bar.c | 14 +++----------- src/st/st-scroll-view.c | 26 +++++--------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c index b8f4f7289..8353109b0 100644 --- a/src/st/st-scroll-bar.c +++ b/src/st/st-scroll-bar.c @@ -444,14 +444,12 @@ st_scroll_bar_scroll_event (ClutterActor *actor, ClutterScrollEvent *event) { StScrollBarPrivate *priv = ST_SCROLL_BAR (actor)->priv; - gdouble lower, step, upper, value, delta_x, delta_y; + gdouble step, value, delta_x, delta_y; if (priv->adjustment) { g_object_get (priv->adjustment, - "lower", &lower, "step-increment", &step, - "upper", &upper, "value", &value, NULL); } @@ -472,17 +470,11 @@ st_scroll_bar_scroll_event (ClutterActor *actor, break; case CLUTTER_SCROLL_UP: case CLUTTER_SCROLL_LEFT: - if (value == lower) - return FALSE; - else - st_adjustment_set_value (priv->adjustment, value - step); + st_adjustment_set_value (priv->adjustment, value - step); break; case CLUTTER_SCROLL_DOWN: case CLUTTER_SCROLL_RIGHT: - if (value == upper) - return FALSE; - else - st_adjustment_set_value (priv->adjustment, value + step); + st_adjustment_set_value (priv->adjustment, value + step); break; } diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index 4ff7918e3..c8f89ceee 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -687,7 +687,7 @@ st_scroll_view_scroll_event (ClutterActor *self, ClutterScrollEvent *event) { StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv; - gdouble lower, value, upper, step, hvalue, vvalue, delta_x, delta_y; + gdouble value, step, hvalue, vvalue, delta_x, delta_y; /* don't handle scroll events if requested not to */ if (!priv->mouse_scroll) @@ -708,19 +708,15 @@ st_scroll_view_scroll_event (ClutterActor *self, case CLUTTER_SCROLL_UP: case CLUTTER_SCROLL_DOWN: g_object_get (priv->vadjustment, - "lower", &lower, "step-increment", &step, "value", &value, - "upper", &upper, NULL); break; case CLUTTER_SCROLL_LEFT: case CLUTTER_SCROLL_RIGHT: g_object_get (priv->hadjustment, - "lower", &lower, "step-increment", &step, "value", &value, - "upper", &upper, NULL); break; } @@ -732,28 +728,16 @@ st_scroll_view_scroll_event (ClutterActor *self, st_adjustment_set_value (priv->vadjustment, vvalue + delta_y); break; case CLUTTER_SCROLL_UP: - if (value == lower) - return FALSE; - else - st_adjustment_set_value (priv->vadjustment, value - step); + st_adjustment_set_value (priv->vadjustment, value - step); break; case CLUTTER_SCROLL_DOWN: - if (value == upper) - return FALSE; - else - st_adjustment_set_value (priv->vadjustment, value + step); + st_adjustment_set_value (priv->vadjustment, value + step); break; case CLUTTER_SCROLL_LEFT: - if (value == lower) - return FALSE; - else - st_adjustment_set_value (priv->hadjustment, value - step); + st_adjustment_set_value (priv->hadjustment, value - step); break; case CLUTTER_SCROLL_RIGHT: - if (value == upper) - return FALSE; - else - st_adjustment_set_value (priv->hadjustment, value + step); + st_adjustment_set_value (priv->hadjustment, value + step); break; }