Adjust brightness control to the corrected 'brightnessGet' DCOP call in tdepowersave

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/53/head
Michele Calgaro 8 months ago
parent 2c7c646af5
commit ae4a3892ff
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -283,25 +283,28 @@ void GenericMonitor::brightnessChange(int direction, int step)
DCOPReply reply = tdepowersave->call("brightnessGet");
if (reply.isValid())
{
int brightnessLevel = 100 + (int)reply; // reply value is a negative number between 0 and -100.
brightnessLevel += direction * step; // add requested brightness step
if (brightnessLevel > 100)
int brightnessLevel = (int)reply;
if (brightnessLevel >= 0)
{
brightnessLevel = 100;
brightnessLevel += direction * step; // add requested brightness step
if (brightnessLevel > 100)
{
brightnessLevel = 100;
}
if (brightnessLevel < 0)
{
brightnessLevel = 0;
}
if (direction > 0)
{
tdepowersave->send("do_brightnessUp", step);
}
else if (direction < 0)
{
tdepowersave->send("do_brightnessDown", step);
}
_interface->displayProgress(i18n("Brightness"), brightnessLevel);
}
if (brightnessLevel < 0)
{
brightnessLevel = 0;
}
if (direction > 0)
{
tdepowersave->send("do_brightnessUp", step);
}
else if (direction < 0)
{
tdepowersave->send("do_brightnessDown", step);
}
_interface->displayProgress(i18n("Brightness"), brightnessLevel);
}
}

Loading…
Cancel
Save