6 ex_gui_slider_step_8c example
gullradriel edited this page 2026-10-09 00:55:18 +02:00

ex_gui_slider_step.c

A slider's keyboard and wheel increment, apart from its snapping step (headless). n_gui_slider_set_step() sets one number that every input path reads: the drag, the arrow keys and the wheel. So a program that wants "one arrow press moves this by a third of a stop" also gets "a drag can only land on thirds of a stop", and a program that wants a smooth drag has to leave the step at zero and accept a twentieth of the range per key press.

Those are two questions and they now have two numbers. n_gui_slider_set_key_step() sets how far a key or a notch moves, and does not snap anything. It falls back to the snapping step, and then to a twentieth of the range, so a slider that sets neither behaves exactly as it did before this existed.