#5964 Can't click on client after sleep

This commit is contained in:
Steve Williams 2018-03-29 09:54:53 +01:00
parent 35fb8c3389
commit eb4047b9fb
3 changed files with 52 additions and 1 deletions

View File

@ -39,6 +39,7 @@
#include "base/IEventQueue.h" #include "base/IEventQueue.h"
#include "base/TMethodEventJob.h" #include "base/TMethodEventJob.h"
#include "base/TMethodJob.h" #include "base/TMethodJob.h"
#include "synergy/DisplayInvalidException.h"
#include <math.h> #include <math.h>
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
@ -107,7 +108,7 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
{ {
m_displayID = CGMainDisplayID(); m_displayID = CGMainDisplayID();
if (!updateScreenShape(m_displayID, 0)) { if (!updateScreenShape(m_displayID, 0)) {
throw std::runtime_error ("failed to initialize screen shape"); throw DisplayInvalidException ("failed to initialize screen shape");
} }
try { try {

View File

@ -32,6 +32,7 @@
#include "ipc/IpcMessage.h" #include "ipc/IpcMessage.h"
#include "ipc/Ipc.h" #include "ipc/Ipc.h"
#include "base/EventQueue.h" #include "base/EventQueue.h"
#include "DisplayInvalidException.h"
#if SYSAPI_WIN32 #if SYSAPI_WIN32
#include "arch/win32/ArchMiscWindows.h" #include "arch/win32/ArchMiscWindows.h"
@ -50,6 +51,7 @@
#include "platform/OSXDragSimulator.h" #include "platform/OSXDragSimulator.h"
#endif #endif
App* App::s_instance = nullptr; App* App::s_instance = nullptr;
// //
@ -125,6 +127,15 @@ App::run(int argc, char** argv)
// using the exit(int) function! // using the exit(int) function!
result = e.getCode(); result = e.getCode();
} }
catch (DisplayInvalidException& die) {
LOG((CLOG_CRIT "A display invalid exception error occurred: %s\n", die.what()));
// display invalid exceptions can occur when going to sleep. When this process exits, the
// UI will restart us instantly. We don't really want that behevior, so we quies for a bit
(void)sleep(10);
}
catch (std::runtime_error& re) {
LOG((CLOG_CRIT "A runtime error occurred: %s\n", re.what()));
}
catch (std::exception& e) { catch (std::exception& e) {
LOG((CLOG_CRIT "An error occurred: %s\n", e.what())); LOG((CLOG_CRIT "An error occurred: %s\n", e.what()));
} }

View File

@ -0,0 +1,39 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2018 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SYNERGY_DISPLAYINVALIDEXCEPTION_H
#define SYNERGY_DISPLAYINVALIDEXCEPTION_H
#include <stdexcept>
#include <string>
class DisplayInvalidException : public std::runtime_error {
public:
DisplayInvalidException(const char* msg):
std::runtime_error(msg)
{
}
DisplayInvalidException(std::string msg):
std::runtime_error(msg)
{
}
};
#endif //SYNERGY_DISPLAYINVALIDEXCEPTION_H