st/scroll-view: Use ClutterEvent getter methods

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
This commit is contained in:
Carlos Garnacho 2023-08-04 14:23:38 +02:00 committed by Marge Bot
parent 1d6a5f2697
commit 23b439dc50

View File

@ -764,6 +764,7 @@ st_scroll_view_scroll_event (ClutterActor *self,
{ {
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv; StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
ClutterTextDirection direction; ClutterTextDirection direction;
ClutterScrollDirection scroll_direction;
/* 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)
@ -773,8 +774,9 @@ st_scroll_view_scroll_event (ClutterActor *self,
return TRUE; return TRUE;
direction = clutter_actor_get_text_direction (self); 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: case CLUTTER_SCROLL_SMOOTH:
{ {
@ -790,7 +792,7 @@ st_scroll_view_scroll_event (ClutterActor *self,
break; break;
case CLUTTER_SCROLL_UP: case CLUTTER_SCROLL_UP:
case CLUTTER_SCROLL_DOWN: case CLUTTER_SCROLL_DOWN:
adjust_with_direction (priv->vadjustment, event->direction); adjust_with_direction (priv->vadjustment, direction);
break; break;
case CLUTTER_SCROLL_LEFT: case CLUTTER_SCROLL_LEFT:
case CLUTTER_SCROLL_RIGHT: case CLUTTER_SCROLL_RIGHT:
@ -798,13 +800,13 @@ st_scroll_view_scroll_event (ClutterActor *self,
{ {
ClutterScrollDirection dir; ClutterScrollDirection dir;
dir = event->direction == CLUTTER_SCROLL_LEFT ? CLUTTER_SCROLL_RIGHT dir = scroll_direction == CLUTTER_SCROLL_LEFT ? CLUTTER_SCROLL_RIGHT
: CLUTTER_SCROLL_LEFT; : CLUTTER_SCROLL_LEFT;
adjust_with_direction (priv->hadjustment, dir); adjust_with_direction (priv->hadjustment, dir);
} }
else else
{ {
adjust_with_direction (priv->hadjustment, event->direction); adjust_with_direction (priv->hadjustment, direction);
} }
break; break;
default: default: