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

View file

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

View file

@ -1138,6 +1138,14 @@ MSWindowsScreen::onEvent(HWND, UINT msg,
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:
return onDisplayChange(); 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: case WM_POWERBROADCAST:
switch (wParam) { switch (wParam) {
case PBT_APMRESUMEAUTOMATIC: case PBT_APMRESUMEAUTOMATIC: