From ea3e20ade134de85850f6a6c62ddf67322a65d1a Mon Sep 17 00:00:00 2001 From: Chris Simons <35010457+simons-public@users.noreply.github.com> Date: Sun, 16 Dec 2018 15:05:20 -0800 Subject: [PATCH] Added preserveFocus fix (#178) Adds the [preserveFocus configuration](https://github.com/symless/synergy-core/wiki/Text-Config#Focus_Preservation) item to the GUI configuration screen. This is useful if you want to control a system that you are not the only user of. For example, I use barrier to control my HTPC computer sometimes, but I don't want Kodi to lose focus when my cursor leaves the screen since it will cause other inputs (i.e. CEC Remote) to stop working. --- src/gui/src/BaseConfig.cpp | 3 ++- src/gui/src/BaseConfig.h | 2 +- src/gui/src/ScreenSettingsDialog.cpp | 2 ++ src/gui/src/ScreenSettingsDialogBase.ui | 12 +++++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gui/src/BaseConfig.cpp b/src/gui/src/BaseConfig.cpp index 36fe4307..241f590a 100644 --- a/src/gui/src/BaseConfig.cpp +++ b/src/gui/src/BaseConfig.cpp @@ -33,7 +33,8 @@ const char* BaseConfig::m_FixNames[] = "halfDuplexCapsLock", "halfDuplexNumLock", "halfDuplexScrollLock", - "xtestIsXineramaUnaware" + "xtestIsXineramaUnaware", + "preserveFocus" }; const char* BaseConfig::m_SwitchCornerNames[] = diff --git a/src/gui/src/BaseConfig.h b/src/gui/src/BaseConfig.h index f1769bbb..2a34969f 100644 --- a/src/gui/src/BaseConfig.h +++ b/src/gui/src/BaseConfig.h @@ -29,7 +29,7 @@ class BaseConfig public: enum Modifier { DefaultMod = -1, Shift, Ctrl, Alt, Meta, Super, None, NumModifiers }; enum SwitchCorner { TopLeft, TopRight, BottomLeft, BottomRight, NumSwitchCorners }; - enum Fix { CapsLock, NumLock, ScrollLock, XTest, NumFixes }; + enum Fix { CapsLock, NumLock, ScrollLock, XTest, PreserveFocus, NumFixes }; protected: BaseConfig() {} diff --git a/src/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp index 4f294e24..3023b6d4 100644 --- a/src/gui/src/ScreenSettingsDialog.cpp +++ b/src/gui/src/ScreenSettingsDialog.cpp @@ -68,6 +68,7 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) : m_pCheckBoxNumLock->setChecked(m_pScreen->fix(Screen::NumLock)); m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(Screen::ScrollLock)); m_pCheckBoxXTest->setChecked(m_pScreen->fix(Screen::XTest)); + m_pCheckBoxPreserveFocus->setChecked(m_pScreen->fix(Screen::PreserveFocus)); } void ScreenSettingsDialog::accept() @@ -115,6 +116,7 @@ void ScreenSettingsDialog::accept() m_pScreen->setFix(Screen::NumLock, m_pCheckBoxNumLock->isChecked()); m_pScreen->setFix(Screen::ScrollLock, m_pCheckBoxScrollLock->isChecked()); m_pScreen->setFix(Screen::XTest, m_pCheckBoxXTest->isChecked()); + m_pScreen->setFix(Screen::PreserveFocus, m_pCheckBoxPreserveFocus->isChecked()); QDialog::accept(); } diff --git a/src/gui/src/ScreenSettingsDialogBase.ui b/src/gui/src/ScreenSettingsDialogBase.ui index 0d6d7689..992919dd 100644 --- a/src/gui/src/ScreenSettingsDialogBase.ui +++ b/src/gui/src/ScreenSettingsDialogBase.ui @@ -462,7 +462,17 @@ - + + + + Fix Preserve Focus + + + false + + + + Qt::Vertical