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;constdouble delta = 12.0;
switch (direction)
{
case GDK_SCROLL_UP:
vscroll_factor = -delta;
break;
case GDK_SCROLL_DOWN:
vscroll_factor = delta;
break;
default:
// no scrollingbreak;
}
}
elseif (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
{
// Handle smooth scrolling directly
vscroll_factor = y_scroll;
}
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: