From 84dfeec2edc4333cb9b0d24bdef27b274af655ce Mon Sep 17 00:00:00 2001 From: XinyuHou Date: Thu, 24 Nov 2016 12:22:39 +0000 Subject: [PATCH] #6346 Make server bypass lock to screen if it's disable from config option # Conflicts: # src/lib/server/Server.cpp # src/lib/server/Server.h --- src/lib/server/Config.cpp | 7 ++++++- src/lib/server/Server.cpp | 8 ++++++++ src/lib/server/Server.h | 1 + src/lib/synergy/option_types.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index e50cf1d2..5db28725 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -765,10 +765,12 @@ Config::readSectionOptions(ConfigReadContext& s) else if (name == "win32KeepForeground") { addOption("", kOptionWin32KeepForeground, s.parseBoolean(value)); } + else if (name == "disableLockToScreen") { + addOption("", kOptionDisableLockToScreen, s.parseBoolean(value)); + } else if (name == "clipboardSharing") { addOption("", kOptionClipboardSharing, s.parseBoolean(value)); } - else { handled = false; } @@ -1380,6 +1382,9 @@ Config::getOptionName(OptionID id) if (id == kOptionScreenPreserveFocus) { return "preserveFocus"; } + if (id == kOptionDisableLockToScreen) { + return "disableLockToScreen"; + } if (id == kOptionClipboardSharing) { return "clipboardSharing"; } diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 206b145c..3a0ce67e 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -92,6 +92,7 @@ Server::Server( m_sendFileThread(NULL), m_writeToDropDirThread(NULL), m_ignoreFileTransfer(false), + m_disableLockToScreen(false), m_enableClipboard(true), m_sendDragInfoThread(NULL), m_waitDragInfoThread(true), @@ -421,6 +422,10 @@ Server::isLockedToScreenServer() const bool Server::isLockedToScreen() const { + if (m_disableLockToScreen) { + return false; + } + // locked if we say we're locked if (isLockedToScreenServer()) { LOG((CLOG_NOTE "Cursor is locked to screen, check Scroll Lock key")); @@ -1177,6 +1182,9 @@ Server::processOptions() else if (id == kOptionRelativeMouseMoves) { newRelativeMoves = (value != 0); } + else if (id == kOptionDisableLockToScreen) { + m_disableLockToScreen = true; + } else if (id == kOptionClipboardSharing) { m_enableClipboard = (value != 0); diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index a9c5d239..8c522b22 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -473,6 +473,7 @@ private: Thread* m_writeToDropDirThread; String m_dragFileExt; bool m_ignoreFileTransfer; + bool m_disableLockToScreen; bool m_enableClipboard; Thread* m_sendDragInfoThread; diff --git a/src/lib/synergy/option_types.h b/src/lib/synergy/option_types.h index 9c92dc7e..0ac6b358 100644 --- a/src/lib/synergy/option_types.h +++ b/src/lib/synergy/option_types.h @@ -67,6 +67,7 @@ static const OptionID kOptionXTestXineramaUnaware = OPTION_CODE("XTXU" static const OptionID kOptionScreenPreserveFocus = OPTION_CODE("SFOC"); static const OptionID kOptionRelativeMouseMoves = OPTION_CODE("MDLT"); static const OptionID kOptionWin32KeepForeground = OPTION_CODE("_KFW"); +static const OptionID kOptionDisableLockToScreen = OPTION_CODE("DLTS"); static const OptionID kOptionClipboardSharing = OPTION_CODE("CLPS"); //@}