refactor(Settings): move relative Mouse movement setting to general settings

This commit is contained in:
sithlord48 2026-06-15 21:16:27 -04:00 committed by Nick Bolton
parent ba37ff854f
commit 46e90e12ff
7 changed files with 25 additions and 23 deletions

View file

@ -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) | | 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.| | 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 | | 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)| | 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.| | 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 | | 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\1\key=83
hotkeys\1\keys\size=1 hotkeys\1\keys\size=1
hotkeys\size=1 hotkeys\size=1
relativeMouseMoves=false
screens\1\name= screens\1\name=
screens\10\aliasArray\size=0 screens\10\aliasArray\size=0
screens\10\fixArray\1\fix=false 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.| |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.| |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.| |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.| |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.| |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. | |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. |

View file

@ -113,6 +113,7 @@ public:
inline static const auto GridWidth = QStringLiteral("server/gridWidth"); inline static const auto GridWidth = QStringLiteral("server/gridWidth");
inline static const auto Heartbeat = QStringLiteral("server/heartbeat"); inline static const auto Heartbeat = QStringLiteral("server/heartbeat");
inline static const auto Protocol = QStringLiteral("server/protocol"); 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 SwitchDelay = QStringLiteral("server/switchDelay");
inline static const auto SwitchDoubleTap = QStringLiteral("server/switchDoubleTap"); inline static const auto SwitchDoubleTap = QStringLiteral("server/switchDoubleTap");
inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken"); inline static const auto XdpRestoreToken = QStringLiteral("server/xdpRestoreToken");
@ -258,6 +259,7 @@ private:
, Settings::Server::GridWidth , Settings::Server::GridWidth
, Settings::Server::Heartbeat , Settings::Server::Heartbeat
, Settings::Server::Protocol , Settings::Server::Protocol
, Settings::Server::RelativeMouseMoves
, Settings::Server::SwitchDelay , Settings::Server::SwitchDelay
, Settings::Server::SwitchDoubleTap , Settings::Server::SwitchDoubleTap
, Settings::Server::XdpRestoreToken , Settings::Server::XdpRestoreToken
@ -284,6 +286,7 @@ private:
, Settings::Server::EnableSwitchDelay , Settings::Server::EnableSwitchDelay
, Settings::Server::EnableSwitchDoubleTap , Settings::Server::EnableSwitchDoubleTap
, Settings::Server::ExternalConfig , Settings::Server::ExternalConfig
, Settings::Server::RelativeMouseMoves
}; };
// When checking the default values this list contains the ones that default to true. // When checking the default values this list contains the ones that default to true.
@ -315,6 +318,7 @@ private:
, QStringLiteral("internalConfig/protocol") , QStringLiteral("internalConfig/protocol")
, QStringLiteral("internalConfig/numColumns") , QStringLiteral("internalConfig/numColumns")
, QStringLiteral("internalConfig/numRows") , QStringLiteral("internalConfig/numRows")
, QStringLiteral("interlanConfig/relativeMouseMoves")
, QStringLiteral("internalConfig/switchDelay") , QStringLiteral("internalConfig/switchDelay")
, QStringLiteral("internalConfig/switchDoubleTap") , QStringLiteral("internalConfig/switchDoubleTap")
}; };

View file

@ -53,7 +53,6 @@ bool ServerConfig::save(const QString &fileName) const
bool ServerConfig::operator==(const ServerConfig &sc) const bool ServerConfig::operator==(const ServerConfig &sc) const
{ {
return m_Screens == sc.m_Screens && // return m_Screens == sc.m_Screens && //
m_RelativeMouseMoves == sc.m_RelativeMouseMoves && //
m_Win32KeepForeground == sc.m_Win32KeepForeground && // m_Win32KeepForeground == sc.m_Win32KeepForeground && //
m_SwitchCornerSize == sc.m_SwitchCornerSize && // m_SwitchCornerSize == sc.m_SwitchCornerSize && //
m_SwitchCorners == sc.m_SwitchCorners && // m_SwitchCorners == sc.m_SwitchCorners && //
@ -93,7 +92,6 @@ void ServerConfig::commit()
settings().beginGroup("internalConfig"); settings().beginGroup("internalConfig");
settings().remove(""); settings().remove("");
settings().setValue("relativeMouseMoves", relativeMouseMoves());
settings().setValue("win32KeepForeground", win32KeepForeground()); settings().setValue("win32KeepForeground", win32KeepForeground());
settings().setValue("switchCornerSize", switchCornerSize()); settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("defaultLockToScreenState", defaultLockToScreenState()); settings().setValue("defaultLockToScreenState", defaultLockToScreenState());
@ -138,7 +136,6 @@ void ServerConfig::recall()
// ourselves // ourselves
setupScreens(); setupScreens();
setRelativeMouseMoves(settings().value("relativeMouseMoves", false).toBool());
setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool()); setWin32KeepForeground(settings().value("win32KeepForeground", false).toBool());
setSwitchCornerSize(settings().value("switchCornerSize").toInt()); setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool()); setDefaultLockToScreenState(settings().value("defaultLockToScreenState", false).toBool());
@ -229,8 +226,6 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
outStream << "section: options" << Qt::endl; outStream << "section: options" << Qt::endl;
outStream << "\t"
<< "relativeMouseMoves = " << (config.relativeMouseMoves() ? "true" : "false") << Qt::endl;
outStream << "\t" outStream << "\t"
<< "win32KeepForeground = " << (config.win32KeepForeground() ? "true" : "false") << Qt::endl; << "win32KeepForeground = " << (config.win32KeepForeground() ? "true" : "false") << Qt::endl;
outStream << "\t" outStream << "\t"

View file

@ -40,10 +40,6 @@ public:
// //
// New methods // New methods
// //
bool relativeMouseMoves() const
{
return m_RelativeMouseMoves;
}
bool win32KeepForeground() const bool win32KeepForeground() const
{ {
return m_Win32KeepForeground; return m_Win32KeepForeground;
@ -110,10 +106,6 @@ private:
{ {
m_Screens.append(screen); m_Screens.append(screen);
} }
void setRelativeMouseMoves(bool on)
{
m_RelativeMouseMoves = on;
}
void setWin32KeepForeground(bool on) void setWin32KeepForeground(bool on)
{ {
m_Win32KeepForeground = on; m_Win32KeepForeground = on;
@ -154,7 +146,6 @@ private:
bool fixNoServer(const QString &name, int &index); bool fixNoServer(const QString &name, int &index);
private: private:
bool m_RelativeMouseMoves = false;
bool m_Win32KeepForeground = false; bool m_Win32KeepForeground = false;
int m_SwitchCornerSize = 0; int m_SwitchCornerSize = 0;
bool m_DefaultLockToScreenState = false; bool m_DefaultLockToScreenState = false;

View file

@ -82,6 +82,7 @@ void ServerConfigDialog::accept()
Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay); Settings::setValue(Settings::Server::SwitchDelay, m_switchDelay);
Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap); Settings::setValue(Settings::Server::EnableSwitchDoubleTap, m_enableSwitchDoubleTap);
Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap); Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap);
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
QDialog::accept(); QDialog::accept();
} }
@ -245,7 +246,9 @@ void ServerConfigDialog::setHeartbeat(int rate)
void ServerConfigDialog::toggleRelativeMouseMoves(bool enabled) void ServerConfigDialog::toggleRelativeMouseMoves(bool enabled)
{ {
serverConfig().setRelativeMouseMoves(enabled); if (m_relativeMouseMoves == enabled)
return;
m_relativeMouseMoves = enabled;
onChange(); onChange();
} }
@ -356,7 +359,12 @@ void ServerConfigDialog::toggleExternalConfig(bool checked)
ui->widgetExternalConfigControls->setEnabled(checked); ui->widgetExternalConfigControls->setEnabled(checked);
ui->tabWidget->setTabEnabled(0, !checked); ui->tabWidget->setTabEnabled(0, !checked);
ui->tabWidget->setTabEnabled(1, !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); ui->groupCorners->setEnabled(!checked);
serverConfig().setUseExternalConfig(checked); serverConfig().setUseExternalConfig(checked);
onChange(); onChange();
@ -396,7 +404,9 @@ void ServerConfigDialog::loadFromConfig()
m_heartbeatRate = Settings::value(Settings::Server::Heartbeat).toInt(); m_heartbeatRate = Settings::value(Settings::Server::Heartbeat).toInt();
ui->sbHeartbeat->setValue(m_heartbeatRate); 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()); ui->cbWin32KeepForeground->setChecked(serverConfig().win32KeepForeground());
m_enableSwitchDelay = Settings::value(Settings::Server::EnableSwitchDelay).toBool(); m_enableSwitchDelay = Settings::value(Settings::Server::EnableSwitchDelay).toBool();
@ -534,7 +544,8 @@ void ServerConfigDialog::onChange()
m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() && m_enableSwitchDelay == Settings::value(Settings::Server::EnableSwitchDelay).toBool() &&
m_switchDelay == Settings::value(Settings::Server::SwitchDelay).toInt() && m_switchDelay == Settings::value(Settings::Server::SwitchDelay).toInt() &&
m_enableSwitchDoubleTap == Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool() && 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) ui->buttonBox->button(QDialogButtonBox::Ok)
->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig)); ->setEnabled(!isAppConfigDataEqual || !(m_originalServerConfig == m_serverConfig));
} }

View file

@ -108,6 +108,7 @@ private:
int m_heartbeatRate; int m_heartbeatRate;
int m_switchDelay; int m_switchDelay;
int m_switchDoubleTap; int m_switchDoubleTap;
bool m_relativeMouseMoves;
bool m_enableSwitchDelay; bool m_enableSwitchDelay;
bool m_enableSwitchDoubleTap; bool m_enableSwitchDoubleTap;
bool m_originalServerConfigIsExternal; bool m_originalServerConfigIsExternal;

View file

@ -637,7 +637,8 @@ void Config::readSectionOptions(ConfigReadContext &s)
bool handled = true; bool handled = true;
// Skip old option names // 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; continue;
} }
@ -658,8 +659,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
addOption("", kOptionScreenSwitchNeedsControl, s.parseBoolean(value)); addOption("", kOptionScreenSwitchNeedsControl, s.parseBoolean(value));
} else if (name == "switchNeedsAlt") { } else if (name == "switchNeedsAlt") {
addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value)); addOption("", kOptionScreenSwitchNeedsAlt, s.parseBoolean(value));
} else if (name == "relativeMouseMoves") {
addOption("", kOptionRelativeMouseMoves, s.parseBoolean(value));
} else if (name == "win32KeepForeground") { } else if (name == "win32KeepForeground") {
addOption("", kOptionWin32KeepForeground, s.parseBoolean(value)); addOption("", kOptionWin32KeepForeground, s.parseBoolean(value));
} else if (name == "defaultLockToScreenState") { } else if (name == "defaultLockToScreenState") {
@ -730,6 +729,8 @@ void Config::readSectionOptions(ConfigReadContext &s)
addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt()); addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt());
} }
addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt());
throw ServerConfigReadException(s, "unexpected end of options section"); throw ServerConfigReadException(s, "unexpected end of options section");
} }