From a45e81fb15563e47d4db0c79763d6e07c1cd96c0 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sun, 21 Jun 2026 12:24:20 -0400 Subject: [PATCH] refactor: Remove undocumented hold modifiers to switch code --- src/lib/server/Config.cpp | 6 ------ src/lib/server/Config.h | 1 + src/lib/server/Server.cpp | 20 -------------------- src/lib/server/Server.h | 5 ----- 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index 9a8676f44..a65633815 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -628,12 +628,6 @@ void Config::readSectionOptions(ConfigReadContext &s) } catch (SocketAddressException &e) { throw ServerConfigReadException(s, std::string("invalid address argument ") + e.what()); } - } else if (name == "switchNeedsShift") { - addOption("", kOptionScreenSwitchNeedsShift, s.parseBoolean(value)); - } else if (name == "switchNeedsControl") { - addOption("", kOptionScreenSwitchNeedsControl, s.parseBoolean(value)); - } else if (name == "switchNeedsAlt") { - addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value)); } else { handled = false; } diff --git a/src/lib/server/Config.h b/src/lib/server/Config.h index 19f89cae6..8e6dd2a57 100644 --- a/src/lib/server/Config.h +++ b/src/lib/server/Config.h @@ -460,6 +460,7 @@ private: QStringLiteral("clipboardSharingSize"), QStringLiteral("switchCornerSize"), QStringLiteral("switchCorners"), + QStringLiteral("switchNeeds"), QStringLiteral("protocol"), QStringLiteral("heartbeat"), QStringLiteral("switchDelay"), diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index eee188dce..8ce755f24 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -841,16 +841,6 @@ bool Server::isSwitchOkay( stopSwitch(); } - // check for optional needed modifiers - if (KeyModifierMask mods = this->m_primaryClient->getToggleMask(); - !preventSwitch && ((this->m_switchNeedsShift && ((mods & KeyModifierShift) != KeyModifierShift)) || - (this->m_switchNeedsControl && ((mods & KeyModifierControl) != KeyModifierControl)) || - (this->m_switchNeedsAlt && ((mods & KeyModifierAlt) != KeyModifierAlt)))) { - LOG_VERBOSE("need modifiers to switch"); - preventSwitch = true; - stopSwitch(); - } - return !preventSwitch; } @@ -1076,10 +1066,6 @@ void Server::processOptions() return; } - m_switchNeedsShift = false; // it seems if i don't add these - m_switchNeedsControl = false; // lines, the 'reload config' option - m_switchNeedsAlt = false; // doesnt' work correct. - bool newRelativeMoves = m_relativeMoves; for (auto [optionId, optionValue] : *options) { const OptionID id = optionId; @@ -1096,12 +1082,6 @@ void Server::processOptions() m_switchTwoTapDelay = 0.0; } stopSwitchTwoTap(); - } else if (id == kOptionScreenSwitchNeedsControl) { - m_switchNeedsControl = (value != 0); - } else if (id == kOptionScreenSwitchNeedsShift) { - m_switchNeedsShift = (value != 0); - } else if (id == kOptionScreenSwitchNeedsAlt) { - m_switchNeedsAlt = (value != 0); } else if (id == kOptionRelativeMouseMoves) { newRelativeMoves = (value != 0); } else if (id == kOptionDefaultLockToScreenState) { diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index 3e197da4d..5c22b376b 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -454,11 +454,6 @@ private: bool m_switchTwoTapEngaged = false; bool m_switchTwoTapArmed = false; - // modifiers needed before switching - bool m_switchNeedsShift = false; - bool m_switchNeedsControl = false; - bool m_switchNeedsAlt = false; - // relative mouse move option bool m_relativeMoves = false;