From f56e86f34b85c9bbc61a05f21104f45da04c4aa57882e21a4baac8cdf85206fc Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Mon, 26 Jan 2026 03:02:29 -0500 Subject: [PATCH] Better clamping in scrollwheel widget. --- power_console_common.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/power_console_common.h b/power_console_common.h index 1c2c2ea..c4dcdce 100644 --- a/power_console_common.h +++ b/power_console_common.h @@ -4,6 +4,7 @@ #include #include +#include void saverChosen(); void perfChosen(); @@ -31,7 +32,13 @@ class MouseWheelSlider : public Fl_Value_Slider // Negative, because I use this for the Brightness control. const int dy= -Fl::event_dy(); - value( value() - dy * step() ); + const int newVal= value() - dy * step(); + if( 0 ) std::cerr << "newVal: " << newVal << " max: " << maximum() << " min: " << minimum() << std::endl; + if( newVal >= maximum() + and newVal <= minimum() ) + { + value( newVal ); + } do_callback();