About mouse scroll events using GDK3 - Is it safe to use only smooth events?

I’m capturing scroll events with GDK3 listening for all events and filtering GDK_SCROLL.

I get two events, one with “Smooth” deltas, and other with “Non Smooth” deltas. With a touch pad I get mostly smooth events (I guess I get non-smooth when the delta is close to one). With a mouse I get both (smooth and non-smooth).

Will it broadly work (Xorg and Wayland) if I ignore non smooth and listen only smooth events?

Will I get smooth events even if the device does not support it?

Thank you.

I’m not 100% sure, but I seem to recall that in my experience with GTK3, it was not safe to assume you would always get at least one of smooth/non; certainly I’ve ended up with code that has to check for both and use either. And then when moving from X11 to Wayland, I found scrolling not working, because something changed there too… so I think assuming smooth scrolling is always available is likely to come back and bite later. :wink:

With the newer way of doing things, GtkEventControllerScroll, we can enforce DISCRETE events…

The event controller can also be forced to emit discrete events on all devices through GTK_EVENT_CONTROLLER_SCROLL_DISCRETE. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options).

…but nothing is mentioned about the converse, forcing emission of continuous (smooth) events, which - while, again, I’m not totally certain - makes me think you probably cannot rely on always getting smooth events only.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.