static gboolean st_scroll_view_scroll_event (ClutterActor *self, ClutterScrollEvent *event) { StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv; /* don't handle scroll events if requested not to */ if (!priv->mouse_scroll) return FALSE; if (clutter_event_is_pointer_emulated ((ClutterEvent *) event)) return TRUE; switch (event->direction) { case CLUTTER_SCROLL_SMOOTH: { gdouble delta_x, delta_y; clutter_event_get_scroll_delta ((ClutterEvent *)event, &delta_x, &delta_y); st_adjustment_adjust_for_scroll_event (priv->hadjustment, delta_x); st_adjustment_adjust_for_scroll_event (priv->vadjustment, delta_y); } break; case CLUTTER_SCROLL_UP: case CLUTTER_SCROLL_DOWN: adjust_with_direction (priv->vadjustment, event->direction); break; case CLUTTER_SCROLL_LEFT: case CLUTTER_SCROLL_RIGHT: adjust_with_direction (priv->hadjustment, event->direction); break; } return TRUE; }
static gboolean st_scroll_bar_scroll_event (ClutterActor *actor, ClutterScrollEvent *event) { StScrollBarPrivate *priv = ST_SCROLL_BAR (actor)->priv; if (clutter_event_is_pointer_emulated ((ClutterEvent *) event)) return TRUE; switch (event->direction) { case CLUTTER_SCROLL_SMOOTH: { gdouble delta_x, delta_y; clutter_event_get_scroll_delta ((ClutterEvent *)event, &delta_x, &delta_y); if (priv->vertical) st_adjustment_adjust_for_scroll_event (priv->adjustment, delta_y); else st_adjustment_adjust_for_scroll_event (priv->adjustment, delta_x); } break; case CLUTTER_SCROLL_UP: case CLUTTER_SCROLL_DOWN: case CLUTTER_SCROLL_LEFT: case CLUTTER_SCROLL_RIGHT: adjust_with_direction (priv->adjustment, event->direction); break; } return TRUE; }