SYNERGY-1088 Windows client ignores prevent sleeping option

This commit is contained in:
Serhii Hadzhilov
2021-07-23 15:27:16 +03:00
parent 8dd68abf56
commit 1dfafb03dc
4 changed files with 82 additions and 11 deletions

View File

@ -164,6 +164,10 @@ MSWindowsScreen::MSWindowsScreen(
LOG((CLOG_ERR "failed to get desktop path, no drop target available, error=%d", GetLastError()));
}
if (App::instance().argsBase().m_preventSleep) {
m_powerManager.disableSleep();
}
OleInitialize(0);
m_dropWindow = createDropWindow(m_class, "DropWindow");
m_dropTarget = new MSWindowsDropTarget();
@ -248,11 +252,6 @@ MSWindowsScreen::enable()
// watch jump zones
m_hook.setMode(kHOOK_WATCH_JUMP_ZONE);
}
if (App::instance().argsBase().m_preventSleep) {
ArchMiscWindows::addBusyState(ArchMiscWindows::kSYSTEM);
ArchMiscWindows::addBusyState(ArchMiscWindows::kDISPLAY);
}
}
void
@ -268,11 +267,6 @@ MSWindowsScreen::disable()
// enable special key sequences on win95 family
enableSpecialKeys(true);
}
else {
// allow the system to enter power saving mode
ArchMiscWindows::removeBusyState(ArchMiscWindows::kSYSTEM);
ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY);
}
// tell key state
m_keyState->disable();
@ -2086,4 +2080,4 @@ MSWindowsScreen::updateScrollDirection()
});
scrollDirectionUpdateThread.detach();
}
}
}