Allow brightness to go to absolute minimum
This assumes that 1 keeps the backlight on and 0 turns the backlight off.
This commit is contained in:
@ -120,7 +120,7 @@ main( const int argcnt, char **argvec )
|
|||||||
level->value( 0 );
|
level->value( 0 );
|
||||||
level->label( battLevelString.c_str() );
|
level->label( battLevelString.c_str() );
|
||||||
|
|
||||||
brightness->maximum( 1 );
|
brightness->maximum( 0 );
|
||||||
brightness->minimum( 100 );
|
brightness->minimum( 100 );
|
||||||
brightness->step( -1 );
|
brightness->step( -1 );
|
||||||
|
|
||||||
@ -187,7 +187,8 @@ namespace
|
|||||||
int max;
|
int max;
|
||||||
i_max >> max;
|
i_max >> max;
|
||||||
|
|
||||||
int adj= max * pct / 100;
|
// Clamp to never hit 0 backlight or pass max.
|
||||||
|
int adj= std::clamp( max * pct / 100, 1, max );
|
||||||
std::cerr << "Adjustment computed: " << adj << std::endl;
|
std::cerr << "Adjustment computed: " << adj << std::endl;
|
||||||
|
|
||||||
std::ofstream out{ backlightPath / "brightness" };
|
std::ofstream out{ backlightPath / "brightness" };
|
||||||
@ -212,5 +213,5 @@ adjustBrightness( MouseWheelSlider *, void * )
|
|||||||
{
|
{
|
||||||
const int amount= brightness->value();
|
const int amount= brightness->value();
|
||||||
std::cerr << "Adjusting brightness by " << amount << std::endl;
|
std::cerr << "Adjusting brightness by " << amount << std::endl;
|
||||||
changeBrightness( std::clamp( amount, 1, 100 ) );
|
changeBrightness( amount );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user