Commit c40b8ba3 authored by Anthony Fieroni's avatar Anthony Fieroni

[dimdisplay] Waits a bit display to wake-up

Differential Revision: https://phabricator.kde.org/D17874Signed-off-by: Anthony Fieroni's avatarAnthony Fieroni <bvbfan@abv.bg>
parent 7569a5a6
......@@ -23,6 +23,7 @@
#include <powerdevil_debug.h>
#include <QDebug>
#include <QTimer>
#include <KConfigGroup>
#include <KLocalizedString>
......@@ -46,8 +47,10 @@ void DimDisplay::onWakeupFromIdle()
return;
}
// An active inhibition may not let us restore the brightness.
// Let's override it so that we don't leave the user with a dimmed screen.
setBrightnessHelper(m_oldScreenBrightness, m_oldKeyboardBrightness, true);
// We should wait a bit screen to wake-up from sleep
QTimer::singleShot(0, this, [this]() {
setBrightnessHelper(m_oldScreenBrightness, m_oldKeyboardBrightness, true);
});
m_dimmed = false;
}
......
......@@ -341,7 +341,6 @@ void Core::loadProfile(bool force)
if (m_pendingWakeupEvent) {
// Fake activity at this stage, when no timeouts are registered
onResumingFromIdle();
KIdleTime::instance()->simulateUserActivity();
m_pendingWakeupEvent = false;
}
} else {
......@@ -352,7 +351,6 @@ void Core::loadProfile(bool force)
if (m_pendingWakeupEvent) {
// Fake activity at this stage, when no timeouts are registered
onResumingFromIdle();
KIdleTime::instance()->simulateUserActivity();
m_pendingWakeupEvent = false;
}
......@@ -833,6 +831,7 @@ int Core::currentChargePercent() const
void Core::onResumingFromIdle()
{
KIdleTime::instance()->simulateUserActivity();
// Wake up the actions in which an idle action was triggered
std::for_each(m_pendingResumeFromIdleActions.cbegin(), m_pendingResumeFromIdleActions.cend(),
std::mem_fn(&PowerDevil::Action::onWakeupFromIdle));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment