Brightness slider works with mouse wheel.
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@ -88,7 +89,7 @@ scheduledUpdate( void * )
|
||||
int in;
|
||||
inf >> in;
|
||||
|
||||
brightness->value( 101 - 100 * in / max );
|
||||
brightness->value( 100 * in / max );
|
||||
}
|
||||
|
||||
// Since this requires launching bg processes, we only do it at startup and then every 30s.
|
||||
@ -115,9 +116,9 @@ main( const int argcnt, char **argvec )
|
||||
level->value( 0 );
|
||||
level->label( battLevelString.c_str() );
|
||||
|
||||
brightness->minimum( 1 );
|
||||
brightness->maximum( 100 );
|
||||
brightness->step( 1 );
|
||||
brightness->maximum( 1 );
|
||||
brightness->minimum( 100 );
|
||||
brightness->step( -1 );
|
||||
|
||||
|
||||
w->hotspot( w );
|
||||
@ -203,9 +204,9 @@ namespace
|
||||
}
|
||||
|
||||
void
|
||||
adjustBrightness( Fl_Slider *, void * )
|
||||
adjustBrightness( MouseWheelSlider *, void * )
|
||||
{
|
||||
const int amount= 101 - brightness->value();
|
||||
const int amount= brightness->value();
|
||||
std::cerr << "Adjusting brightness by " << amount << std::endl;
|
||||
changeBrightness( amount );
|
||||
changeBrightness( std::clamp( amount, 1, 100 ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user