SYNERGY-124 Windows client doesn't resume connection after sleep (#7082)

* SYNERGY-124 Windows client doesn't resume connection after sleep

* SYNERGY-124 Remove changes from previous PR

* Revert "SYNERGY-124 Remove changes from previous PR"

This reverts commit 9d6afc1523d4c2327176db9bee28b92f3471ca5e.

* Update ChangeLog
This commit is contained in:
SerhiiGadzhilov 2021-09-01 18:58:41 +03:00 committed by GitHub
parent 8d5406489b
commit d4bd004899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

View file

@ -5,6 +5,7 @@ Bug fixes:
- #7078 Fix clipboard re-enables automatically
- #7077 Fix Ubuntu, CentOS and Debian build after SYNERGY-1161
- #7080 Add trace if the system can't open file with trusted fingerprints
- #7082 Windows client doesn't resume connection after sleep
Enhancements:
- #7068 Add Synergy restart when settings changed

View file

@ -767,21 +767,25 @@ Client::handleHello(const Event&, void*)
void
Client::handleSuspend(const Event&, void*)
{
LOG((CLOG_INFO "suspend"));
m_suspended = true;
bool wasConnected = isConnected();
disconnect(NULL);
m_connectOnResume = wasConnected;
if (!m_suspended) {
LOG((CLOG_INFO "suspend"));
m_suspended = true;
bool wasConnected = isConnected();
disconnect(NULL);
m_connectOnResume = wasConnected;
}
}
void
Client::handleResume(const Event&, void*)
{
LOG((CLOG_INFO "resume"));
m_suspended = false;
if (m_connectOnResume) {
m_connectOnResume = false;
connect();
if (m_suspended) {
LOG((CLOG_INFO "resume"));
m_suspended = false;
if (m_connectOnResume) {
m_connectOnResume = false;
connect();
}
}
}

View file

@ -1138,6 +1138,14 @@ MSWindowsScreen::onEvent(HWND, UINT msg,
case WM_DISPLAYCHANGE:
return onDisplayChange();
/* On windows 10 we don't receive WM_POWERBROADCAST after sleep.
We receive only WM_TIMECHANGE hence this message is used to resume.*/
case WM_TIMECHANGE:
m_events->addEvent(Event(m_events->forIScreen().resume(),
getEventTarget(), NULL,
Event::kDeliverImmediately));
break;
case WM_POWERBROADCAST:
switch (wParam) {
case PBT_APMRESUMEAUTOMATIC: