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
This commit is contained in:
Florian Müllner 2012-03-20 00:19:08 +01:00
parent 4fea5b5ca3
commit 700c06023e
2 changed files with 8 additions and 32 deletions

View File

@ -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,16 +470,10 @@ 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);
break;
case CLUTTER_SCROLL_DOWN:
case CLUTTER_SCROLL_RIGHT:
if (value == upper)
return FALSE;
else
st_adjustment_set_value (priv->adjustment, value + step);
break;
}

View File

@ -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,27 +728,15 @@ 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);
break;
case CLUTTER_SCROLL_DOWN:
if (value == upper)
return FALSE;
else
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);
break;
case CLUTTER_SCROLL_RIGHT:
if (value == upper)
return FALSE;
else
st_adjustment_set_value (priv->hadjustment, value + step);
break;
}