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:
parent
4fea5b5ca3
commit
700c06023e
@ -444,14 +444,12 @@ st_scroll_bar_scroll_event (ClutterActor *actor,
|
|||||||
ClutterScrollEvent *event)
|
ClutterScrollEvent *event)
|
||||||
{
|
{
|
||||||
StScrollBarPrivate *priv = ST_SCROLL_BAR (actor)->priv;
|
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)
|
if (priv->adjustment)
|
||||||
{
|
{
|
||||||
g_object_get (priv->adjustment,
|
g_object_get (priv->adjustment,
|
||||||
"lower", &lower,
|
|
||||||
"step-increment", &step,
|
"step-increment", &step,
|
||||||
"upper", &upper,
|
|
||||||
"value", &value,
|
"value", &value,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@ -472,16 +470,10 @@ st_scroll_bar_scroll_event (ClutterActor *actor,
|
|||||||
break;
|
break;
|
||||||
case CLUTTER_SCROLL_UP:
|
case CLUTTER_SCROLL_UP:
|
||||||
case CLUTTER_SCROLL_LEFT:
|
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;
|
break;
|
||||||
case CLUTTER_SCROLL_DOWN:
|
case CLUTTER_SCROLL_DOWN:
|
||||||
case CLUTTER_SCROLL_RIGHT:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -687,7 +687,7 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
|||||||
ClutterScrollEvent *event)
|
ClutterScrollEvent *event)
|
||||||
{
|
{
|
||||||
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
|
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 */
|
/* don't handle scroll events if requested not to */
|
||||||
if (!priv->mouse_scroll)
|
if (!priv->mouse_scroll)
|
||||||
@ -708,19 +708,15 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
|||||||
case CLUTTER_SCROLL_UP:
|
case CLUTTER_SCROLL_UP:
|
||||||
case CLUTTER_SCROLL_DOWN:
|
case CLUTTER_SCROLL_DOWN:
|
||||||
g_object_get (priv->vadjustment,
|
g_object_get (priv->vadjustment,
|
||||||
"lower", &lower,
|
|
||||||
"step-increment", &step,
|
"step-increment", &step,
|
||||||
"value", &value,
|
"value", &value,
|
||||||
"upper", &upper,
|
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
case CLUTTER_SCROLL_LEFT:
|
case CLUTTER_SCROLL_LEFT:
|
||||||
case CLUTTER_SCROLL_RIGHT:
|
case CLUTTER_SCROLL_RIGHT:
|
||||||
g_object_get (priv->hadjustment,
|
g_object_get (priv->hadjustment,
|
||||||
"lower", &lower,
|
|
||||||
"step-increment", &step,
|
"step-increment", &step,
|
||||||
"value", &value,
|
"value", &value,
|
||||||
"upper", &upper,
|
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -732,27 +728,15 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
|||||||
st_adjustment_set_value (priv->vadjustment, vvalue + delta_y);
|
st_adjustment_set_value (priv->vadjustment, vvalue + delta_y);
|
||||||
break;
|
break;
|
||||||
case CLUTTER_SCROLL_UP:
|
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;
|
break;
|
||||||
case CLUTTER_SCROLL_DOWN:
|
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;
|
break;
|
||||||
case CLUTTER_SCROLL_LEFT:
|
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;
|
break;
|
||||||
case CLUTTER_SCROLL_RIGHT:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user