From 0330d212e60fb4abf2b4ad57cca2208ba6109d07a5a3093547a5e79bbf775e22 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 17 Jun 2026 13:29:37 -0400 Subject: [PATCH] Use up and down arrows to adjust brightness. Polarity is now the right way. --- power_console_common.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/power_console_common.h b/power_console_common.h index c4dcdce..58def32 100644 --- a/power_console_common.h +++ b/power_console_common.h @@ -46,6 +46,28 @@ class MouseWheelSlider : public Fl_Value_Slider } break; + case FL_KEYBOARD: + { + const auto key= Fl::event_key(); + if( key != FL_Down and key != FL_Up ) + { + return this->Fl_Value_Slider::handle( event ); + } + + const int polarity= Fl::event_key() == FL_Down ? +1 : -1; + const int newVal= value() + polarity * step(); + if( newVal >= maximum() + and newVal <= minimum() ) + { + value( newVal ); + } + + do_callback(); + + return 1; + } + break; + default: { return this->Fl_Value_Slider::handle( event );