aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Tätzner <gregor@freenet.de>2012-11-21 19:47:57 (GMT)
committerGregor Tätzner <gregor@freenet.de>2012-11-21 19:56:41 (GMT)
commit1d08f4779a26ebba757111fd99182034e5282624 (patch)
treebc4fc43c3dd66c6bfbde643da319dc3242790a72
parent2cceb579e60aadf881516ed69da7394cfa4dc22d (diff)
Fix screenBrightnessChanged signal in upower backend
emit onBrightnessChanged every time when a new brightness gets set and not just on brightnessKey press BUG: 302111, 302160 FIXED-IN: 4.9.4 REVIEW: 107398
-rw-r--r--powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp b/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp
index 3d0926f..97a409b 100644
--- a/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp
+++ b/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp
@@ -170,13 +170,7 @@ void PowerDevilUPowerBackend::brightnessKeyPressed(PowerDevil::BackendInterface:
newBrightness = qMax(0.0f, currentBrightness - 10);
}
- if (setBrightness(newBrightness, Screen)) {
- newBrightness = brightness(Screen);
- if (!qFuzzyCompare(newBrightness, m_cachedBrightness)) {
- m_cachedBrightness = newBrightness;
- onBrightnessChanged(Screen, m_cachedBrightness);
- }
- }
+ setBrightness(newBrightness, Screen);
} else {
m_cachedBrightness = currentBrightness;
}
@@ -214,6 +208,7 @@ float PowerDevilUPowerBackend::brightness(PowerDevil::BackendInterface::Brightne
bool PowerDevilUPowerBackend::setBrightness(float brightnessValue, PowerDevil::BackendInterface::BrightnessControlType type)
{
+ bool success = false;
if (type == Screen) {
kDebug() << "set screen brightness: " << brightnessValue;
if (m_brightnessControl->isSupported()) {
@@ -230,10 +225,19 @@ bool PowerDevilUPowerBackend::setBrightness(float brightnessValue, PowerDevil::B
}
}
- return true;
+ success = true;
} else if (type == Keyboard) {
kDebug() << "set kbd backlight: " << brightnessValue;
m_kbdBacklight->SetBrightness(brightnessValue / 100 * m_kbdBacklight->GetMaxBrightness());
+ success = true;
+ }
+
+ if (success) {
+ float newBrightness = brightness(Screen);
+ if (!qFuzzyCompare(newBrightness, m_cachedBrightness)) {
+ m_cachedBrightness = newBrightness;
+ onBrightnessChanged(Screen, m_cachedBrightness);
+ }
return true;
}