st/scroll-view: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
This commit is contained in:
parent
1d6a5f2697
commit
23b439dc50
@ -764,6 +764,7 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
||||
{
|
||||
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
|
||||
ClutterTextDirection direction;
|
||||
ClutterScrollDirection scroll_direction;
|
||||
|
||||
/* don't handle scroll events if requested not to */
|
||||
if (!priv->mouse_scroll)
|
||||
@ -773,8 +774,9 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
||||
return TRUE;
|
||||
|
||||
direction = clutter_actor_get_text_direction (self);
|
||||
scroll_direction = clutter_event_get_scroll_direction ((ClutterEvent *) event);
|
||||
|
||||
switch (event->direction)
|
||||
switch (scroll_direction)
|
||||
{
|
||||
case CLUTTER_SCROLL_SMOOTH:
|
||||
{
|
||||
@ -790,7 +792,7 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
||||
break;
|
||||
case CLUTTER_SCROLL_UP:
|
||||
case CLUTTER_SCROLL_DOWN:
|
||||
adjust_with_direction (priv->vadjustment, event->direction);
|
||||
adjust_with_direction (priv->vadjustment, direction);
|
||||
break;
|
||||
case CLUTTER_SCROLL_LEFT:
|
||||
case CLUTTER_SCROLL_RIGHT:
|
||||
@ -798,13 +800,13 @@ st_scroll_view_scroll_event (ClutterActor *self,
|
||||
{
|
||||
ClutterScrollDirection dir;
|
||||
|
||||
dir = event->direction == CLUTTER_SCROLL_LEFT ? CLUTTER_SCROLL_RIGHT
|
||||
dir = scroll_direction == CLUTTER_SCROLL_LEFT ? CLUTTER_SCROLL_RIGHT
|
||||
: CLUTTER_SCROLL_LEFT;
|
||||
adjust_with_direction (priv->hadjustment, dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
adjust_with_direction (priv->hadjustment, event->direction);
|
||||
adjust_with_direction (priv->hadjustment, direction);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user