Package: gdk

Accessor gdk-event-scroll-direction

Lambda List

gdk-event-scroll-direction (instance)

Syntax

(gdk-event-scroll-direction instance) => direction
(setf (gdk-event-scroll-direction instance) direction)

Arguments

instance -- a gdk-event-scroll instance
direction -- a value of the gdk-scroll-direction enumeration

Details

Accessor of the direction slot of the gdk-event-scroll structure. The gdk-scroll-direction function extracts the scroll direction from a scroll event.

If you wish to handle both discrete and smooth scrolling, you should check the return value of this function, or of the gdk-event-scroll-deltas function. 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; }
 

See also

2021-12-13