Event.getScrollDirection

bool getScrollDirection(out gdk.types.ScrollDirection direction)

Extracts the scroll direction from an event.

If event is not of type [gdk.types.EventType.Scroll], the contents of direction are undefined.

If you wish to handle both discrete and smooth scrolling, you should check the return value of this function, or of [gdk.event.Event.getScrollDeltas]; for instance:

GdkScrollDirection direction;
 double vscroll_factor = 0.0;
 double x_scroll, y_scroll;

 if (gdk_event_get_scroll_direction (event, &direction))
   {
     // Handle discrete scrolling with a known constant delta;
     const double delta = 12.0;

     switch (direction)
       {
       case GDK_SCROLL_UP:
         vscroll_factor = -delta;
         break;
       case GDK_SCROLL_DOWN:
         vscroll_factor = delta;
         break;
       default:
         // no scrolling
         break;
       }
   }
 else if (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
   {
     // Handle smooth scrolling directly
     vscroll_factor = y_scroll;
   }

Parameters

directionlocation to store the scroll direction

Returns

true if the event delivered a scroll direction

and false otherwise