diff --git a/docs/user/configuration.md b/docs/user/configuration.md index aab178c6c..b6bccba80 100644 --- a/docs/user/configuration.md +++ b/docs/user/configuration.md @@ -151,6 +151,7 @@ This section contains options used when in server mode it will begin with `[serv | gridWidth | int | Width of the server's intenal grid used for the computer layout (default: 5) | | heartbeat | int | The server will expect each client to send a message no less than every `N` milliseconds. If no message arrives from a client within `3N` seconds the server forces that client to disconnect. If deskflow fails to detect clients disconnecting while the server is sleeping or vice versa, try using this option.| | protocol | `barrier` or `synergy` | The protocol to use when saying hello to clients. Can be set to barrier or synergy. If not set barrier is used as the default | +|relativeMouseMoves | `true` or `false` | If set to ''true'' then secondary computers move the mouse using relative rather than absolute mouse moves when and only when the cursor is locked to the computer (by ''Scroll Lock'' or a configured hot key). This is intended to make Deskflow work better with certain games. If set to ''false'' or not set then all mouse moves are absolute.| | switchDelay | int | Deskflow won't switch computers when the mouse reaches edge of a computer unless it stays on the edge for `N` milliseconds. This helps prevent unintentional switching when working near an edge. (default: 250)| | switchDoubleTap | int | Deskflow won't switch computers when the mouse reaches the edge of a computer unless it's moved away from the edge and then back to the edge within `N` milliseconds. With the option you have to quickly tap the edge twice to switch. This helps prevent unintentional switching when working near the edge.| | xdpRestoreToken | UUID | Restore token provided by XDG portals | @@ -182,7 +183,6 @@ hotkeys\1\actions\size=1 hotkeys\1\keys\1\key=83 hotkeys\1\keys\size=1 hotkeys\size=1 -relativeMouseMoves=false screens\1\name= screens\10\aliasArray\size=0 screens\10\fixArray\1\fix=false @@ -403,7 +403,6 @@ end |switchCorners | none top-left top-right bottom-left bottom-right left right top bottom all | Deskflow won't switch computers when the mouse reaches the edge of the computer if it's in a listed corner. The size of all corners is given by the `switchCornerSize` option. The first name in the list is one of the above names and defines the initial set of corners. Subsequent names are prefixed with + or - to add the corner to or remove the corner from the set, respectively. For example: `all -left +top-left` starts will all corners, removes the left corners (top and bottom) then adds the top-left back in, resulting in the top-left, bottom-left and bottom-right corners.| |switchCornerSize | integer (N) | Sets the size of all corners in pixels. The cursor must be within `N` pixels of the corner to be considered to be in the corner.| |screenSaverSync| `true` or `false`| ''Note: Removed in v1.14.1'' If set to ''false'' then Deskflow won't synchronize screen savers. Client screen savers will start according to their individual configurations. The server screen saver won't start if there is input, even if that input is directed toward a client computer.| -|relativeMouseMoves| `true` or `false`| If set to ''true'' then secondary computers move the mouse using relative rather than absolute mouse moves when and only when the cursor is locked to the computer (by ''Scroll Lock'' or a configured hot key). This is intended to make Deskflow work better with certain games. If set to ''false'' or not set then all mouse moves are absolute.| |clipboardSharing| `true` or `false`|If set to ''true'' then clipboard sharing will be enabled and the ''clipboardSharingSize'' setting will be used. If set to false, then clipboard sharing will be disabled and the the ''clipboardSharingSize'' setting will be ignored.| |clipboardSharingSize| integer (N)| Deskflow will send a maximum of `N` kilobytes of clipboard data to another computer when the mouse transitions to that computer.| |win32KeepForeground | `true` or `false`| If set to ''true'' (the default), Deskflow will grab the foreground focus on a Windows server (thereby putting all other windows in the background) upon switching to a client. If set to ''false'', it will leave the currently foreground window in the foreground. Deskflow grabs the focus to avoid issues with other apps interfering with Deskflow's ability to read the hardware inputs. | diff --git a/src/lib/common/Settings.h b/src/lib/common/Settings.h index 592a76d19..55718f078 100644 --- a/src/lib/common/Settings.h +++ b/src/lib/common/Settings.h @@ -113,6 +113,7 @@ public: inline static const auto GridWidth = QStringLiteral("server/gridWidth"); inline static const auto Heartbeat = QStringLiteral("server/heartbeat"); inline static const auto Protocol = QStringLiteral("server/protocol"); + inline static const auto RelativeMouseMoves = QStringLiteral("server/relativeMouseMoves"); inline static const auto SwitchDelay = QStringLiteral("server/switchDelay"); inline static const auto SwitchDoubleTap = QStringLiteral("server/switchDoubleTap"); inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken"); @@ -258,6 +259,7 @@ private: , Settings::Server::GridWidth , Settings::Server::Heartbeat , Settings::Server::Protocol + , Settings::Server::RelativeMouseMoves , Settings::Server::SwitchDelay , Settings::Server::SwitchDoubleTap , Settings::Server::XdpRestoreToken @@ -284,6 +286,7 @@ private: , Settings::Server::EnableSwitchDelay , Settings::Server::EnableSwitchDoubleTap , Settings::Server::ExternalConfig + , Settings::Server::RelativeMouseMoves }; // When checking the default values this list contains the ones that default to true. @@ -315,6 +318,7 @@ private: , QStringLiteral("internalConfig/protocol") , QStringLiteral("internalConfig/numColumns") , QStringLiteral("internalConfig/numRows") + , QStringLiteral("interlanConfig/relativeMouseMoves") , QStringLiteral("internalConfig/switchDelay") , QStringLiteral("internalConfig/switchDoubleTap") }; diff --git a/src/lib/gui/config/ServerConfig.cpp b/src/lib/gui/config/ServerConfig.cpp index f19e4d9de..50fe1e065 100644 --- a/src/lib/gui/config/ServerConfig.cpp +++ b/src/lib/gui/config/ServerConfig.cpp @@ -53,7 +53,6 @@ bool ServerConfig::save(const QString &fileName) const bool ServerConfig::operator==(const ServerConfig &sc) const { return m_Screens == sc.m_Screens && // - m_RelativeMouseMoves == sc.m_RelativeMouseMoves && // m_Win32KeepForeground == sc.m_Win32KeepForeground && // m_SwitchCornerSize == sc.m_SwitchCornerSize && // m_SwitchCorners == sc.m_SwitchCorners && // @@ -93,7 +92,6 @@ void ServerConfig::commit() settings().beginGroup("internalConfig"); settings().remove(""); - settings().setValue("relativeMouseMoves", relativeMouseMoves()); settings().setValue("win32KeepForeground", win32KeepForeground()); settings().setValue("switchCornerSize", switchCornerSize()); settings().setValue("defaultLockToScreenState", defaultLockToScreenState()); @@ -138,7 +136,6 @@ void ServerConfig::recall() // ourselves setupScreens(); - setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool()); setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool()); setSwitchCornerSize(settings().value("switchCornerSize").toInt()); setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool()); @@ -229,8 +226,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config) outStream << "section: options" << Qt::endl; - outStream << "\t" - << "relativeMouseMoves = " << (config.relativeMouseMoves() ? "true" : "false") << Qt::endl; outStream << "\t" << "win32KeepForeground = " << (config.win32KeepForeground() ? "true" : "false") << Qt::endl; outStream << "\t" diff --git a/src/lib/gui/config/ServerConfig.h b/src/lib/gui/config/ServerConfig.h index 58e123ed8..0ed2b3494 100644 --- a/src/lib/gui/config/ServerConfig.h +++ b/src/lib/gui/config/ServerConfig.h @@ -40,10 +40,6 @@ public: // // New methods // - bool relativeMouseMoves() const - { - return m_RelativeMouseMoves; - } bool win32KeepForeground() const { return m_Win32KeepForeground; @@ -110,10 +106,6 @@ private: { m_Screens.append(screen); } - void setRelativeMouseMoves(bool on) - { - m_RelativeMouseMoves = on; - } void setWin32KeepForeground(bool on) { m_Win32KeepForeground = on; @@ -154,7 +146,6 @@ private: bool fixNoServer(const QString &name, int &index); private: - bool m_RelativeMouseMoves = false; bool m_Win32KeepForeground = false; int m_SwitchCornerSize = 0; bool m_DefaultLockToScreenState = false; diff --git a/src/lib/gui/dialogs/ServerConfigDialog.cpp b/src/lib/gui/dialogs/ServerConfigDialog.cpp index 66490d630..1394e09cb 100644 --- a/src/lib/gui/dialogs/ServerConfigDialog.cpp +++ b/src/lib/gui/dialogs/ServerConfigDialog.cpp @@ -82,6 +82,7 @@ void ServerConfigDialog::accept() Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay); Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap); Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap); + Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves); QDialog::accept(); } @@ -245,7 +246,9 @@ void ServerConfigDialog::setHeartbeat(int rate) void ServerConfigDialog::toggleRelativeMouseMoves(bool enabled) { - serverConfig().setRelativeMouseMoves(enabled); + if (m_relativeMouseMoves == enabled) + return; + m_relativeMouseMoves = enabled; onChange(); } @@ -356,7 +359,12 @@ void ServerConfigDialog::toggleExternalConfig(bool checked) ui->widgetExternalConfigControls->setEnabled(checked); ui->tabWidget->setTabEnabled(0, !checked); ui->tabWidget->setTabEnabled(1, !checked); - ui->groupMisc->setEnabled(!checked); + ui->cbDefaultLockToScreenState->setEnabled(!checked); + ui->cbDisableLockToScreen->setEnabled(!checked); + ui->cbWin32KeepForeground->setEnabled(!checked); + ui->cbEnableClipboard->setEnabled(!checked); + ui->label_7->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked()); + ui->sbClipboardSizeLimit->setEnabled(checked ? !checked : ui->cbEnableClipboard->isChecked()); ui->groupCorners->setEnabled(!checked); serverConfig().setUseExternalConfig(checked); onChange(); @@ -396,7 +404,9 @@ void ServerConfigDialog::loadFromConfig() m_heartbeatRate = Settings::value(Settings::Server::Heartbeat).toInt(); ui->sbHeartbeat->setValue(m_heartbeatRate); - ui->cbRelativeMouseMoves->setChecked(serverConfig().relativeMouseMoves()); + m_relativeMouseMoves = Settings::value(Settings::Server::RelativeMouseMoves).toBool(); + ui->cbRelativeMouseMoves->setChecked(m_relativeMouseMoves); + ui->cbWin32KeepForeground->setChecked(serverConfig().win32KeepForeground()); m_enableSwitchDelay = Settings::value(Settings::Server::EnableSwitchDelay).toBool(); @@ -534,7 +544,8 @@ void ServerConfigDialog::onChange() m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() && m_switchDelay == Settings::value(Settings::Server::SwitchDelay).toInt() && m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool() && - m_switchDoubleTap == Settings::value(Settings::Server::SwitchDoubleTap).toInt(); + m_switchDoubleTap == Settings::value(Settings::Server::SwitchDoubleTap).toInt() && + m_relativeMouseMoves == Settings::value(Settings::Server::RelativeMouseMoves).toBool(); ui->buttonBox->button(QDialogButtonBox::Ok) ->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig)); } diff --git a/src/lib/gui/dialogs/ServerConfigDialog.h b/src/lib/gui/dialogs/ServerConfigDialog.h index 73a307396..0ba3e49ba 100644 --- a/src/lib/gui/dialogs/ServerConfigDialog.h +++ b/src/lib/gui/dialogs/ServerConfigDialog.h @@ -108,6 +108,7 @@ private: int m_heartbeatRate; int m_switchDelay; int m_switchDoubleTap; + bool m_relativeMouseMoves; bool m_enableSwitchDelay; bool m_enableSwitchDoubleTap; bool m_originalServerConfigIsExternal; diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index f09acc1f5..7a66e6bea 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -637,7 +637,8 @@ void Config::readSectionOptions(ConfigReadContext &s) bool handled = true; // Skip old option names - if (name == "protocol" || name == "heartbeat" || name == "switchDelay" || name == "switchDoubleTap") { + if (name == "protocol" || name == "heartbeat" || name == "switchDelay" || name == "switchDoubleTap" || + name == "relativeMouseMoves") { continue; } @@ -658,8 +659,6 @@ void Config::readSectionOptions(ConfigReadContext &s) addOption("", kOptionScreenSwitchNeedsControl, s.parseBoolean(value)); } else if (name == "switchNeedsAlt") { addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value)); - } else if (name == "relativeMouseMoves") { - addOption("", kOptionRelativeMouseMoves, s.parseBoolean(value)); } else if (name == "win32KeepForeground") { addOption("", kOptionWin32KeepForeground, s.parseBoolean(value)); } else if (name == "defaultLockToScreenState") { @@ -730,6 +729,8 @@ void Config::readSectionOptions(ConfigReadContext &s) addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt()); } + addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt()); + throw ServerConfigReadException(s, "unexpected end of options section"); }