-rw-r--r-- | core/launcher/desktop.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 387650b..d2bd8ae 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -169,3 +169,4 @@ public: | |||
169 | 169 | ||
170 | m_backlight_bright = -1; | 170 | m_backlight_normal = -1; |
171 | m_backlight_current = -1; | ||
171 | m_backlight_forcedoff = false; | 172 | m_backlight_forcedoff = false; |
@@ -174,2 +175,3 @@ public: | |||
174 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 175 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
176 | setBacklight ( -1 ); | ||
175 | } | 177 | } |
@@ -182,3 +184,3 @@ public: | |||
182 | 184 | ||
183 | setBacklight ( -1 ); | 185 | setBacklightInternal ( -1 ); |
184 | } | 186 | } |
@@ -189,4 +191,4 @@ public: | |||
189 | if ( m_disable_suspend > 0 && m_enable_dim ) { | 191 | if ( m_disable_suspend > 0 && m_enable_dim ) { |
190 | if ( backlight() > 1 ) | 192 | if ( m_backlight_current > 1 ) |
191 | setBacklight( 1 ); // lowest non-off | 193 | setBacklightInternal ( 1 ); // lowest non-off |
192 | } | 194 | } |
@@ -196,3 +198,3 @@ public: | |||
196 | if ( m_disable_suspend > 1 && m_enable_lightoff ) { | 198 | if ( m_disable_suspend > 1 && m_enable_lightoff ) { |
197 | setBacklight( 0 ); // off | 199 | setBacklightInternal ( 0 ); // off |
198 | } | 200 | } |
@@ -272,5 +274,4 @@ public: | |||
272 | 274 | ||
273 | int backlight ( ) | 275 | void setBacklight ( int bright ) |
274 | { | 276 | { |
275 | if ( m_backlight_bright == -1 ) { | ||
276 | // Read from config | 277 | // Read from config |
@@ -278,8 +279,9 @@ public: | |||
278 | config. setGroup ( "Screensaver" ); | 279 | config. setGroup ( "Screensaver" ); |
279 | m_backlight_bright = config. readNumEntry ( "Brightness", 255 ); | 280 | m_backlight_normal = config. readNumEntry ( "Brightness", 255 ); |
280 | } | 281 | |
281 | return m_backlight_bright; | 282 | setBacklightInternal ( bright ); |
282 | } | 283 | } |
283 | 284 | ||
284 | void setBacklight ( int bright ) | 285 | private: |
286 | void setBacklightInternal ( int bright ) | ||
285 | { | 287 | { |
@@ -294,14 +296,15 @@ public: | |||
294 | // Toggle between off and on | 296 | // Toggle between off and on |
295 | bright = m_backlight_bright ? 0 : -1; | 297 | bright = m_backlight_current ? 0 : -1; |
296 | m_backlight_forcedoff = !bright; | 298 | m_backlight_forcedoff = !bright; |
297 | } | 299 | } |
300 | if ( bright == -1 ) | ||
301 | bright = m_backlight_normal; | ||
298 | 302 | ||
299 | m_backlight_bright = bright; | 303 | if ( bright != m_backlight_current ) { |
300 | |||
301 | bright = backlight ( ); | ||
302 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 304 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
303 | 305 | m_backlight_current = bright; | |
304 | m_backlight_bright = bright; | 306 | } |
305 | } | 307 | } |
306 | 308 | ||
309 | public: | ||
307 | void setDisplayState ( bool on ) | 310 | void setDisplayState ( bool on ) |
@@ -322,3 +325,4 @@ private: | |||
322 | 325 | ||
323 | int m_backlight_bright; | 326 | int m_backlight_normal; |
327 | int m_backlight_current; | ||
324 | bool m_backlight_forcedoff; | 328 | bool m_backlight_forcedoff; |