fix: vertical scroll scaling on all platforms

fixes: #9120
This commit is contained in:
sithlord48 2026-02-04 18:16:38 -05:00 committed by Chris Rizzitello
parent a960f2ff30
commit 5e8a6f0bcb
13 changed files with 104 additions and 61 deletions

View file

@ -57,6 +57,7 @@ It will begin with `[client]`
| invertScrollDirection | `true` or `false` | Invert scroll on this client [default: false] | | invertScrollDirection | `true` or `false` | Invert scroll on this client [default: false] |
| languageSync | `true` or `false` | Sync to server language [default: true] | | languageSync | `true` or `false` | Sync to server language [default: true] |
| remoteHost | `IP` or `hostname` | The remote host(s) to connect to. Use a comma seperated list when you want to try severial hosts | | remoteHost | `IP` or `hostname` | The remote host(s) to connect to. Use a comma seperated list when you want to try severial hosts |
| yScrollScale | Double 0.1 - 10.0 | Mouse scrolling will be scaled by this amount on the client [default: 1.0] |
| xdpRestoreToken | UUID | Restore token provided by XDG portals | | xdpRestoreToken | UUID | Restore token provided by XDG portals |
### Core ### Core

View file

@ -204,8 +204,8 @@ QVariant Settings::defaultValue(const QString &key)
if (key == Daemon::LogFile) if (key == Daemon::LogFile)
return QStringLiteral("%1/%2-daemon.log").arg(Settings::settingsPath(), kAppId); return QStringLiteral("%1/%2-daemon.log").arg(Settings::settingsPath(), kAppId);
if (key == Client::ScrollSpeed) if (key == Client::YScrollScale)
return 120; return 1.0;
return QVariant(); return QVariant();
} }

View file

@ -36,6 +36,7 @@ public:
{ {
inline static const auto InvertScrollDirection = QStringLiteral("client/invertScrollDirection"); inline static const auto InvertScrollDirection = QStringLiteral("client/invertScrollDirection");
inline static const auto ScrollSpeed = QStringLiteral("client/yscroll"); inline static const auto ScrollSpeed = QStringLiteral("client/yscroll");
inline static const auto YScrollScale = QStringLiteral("client/yScrollScale");
inline static const auto LanguageSync = QStringLiteral("client/languageSync"); inline static const auto LanguageSync = QStringLiteral("client/languageSync");
inline static const auto RemoteHost = QStringLiteral("client/remoteHost"); inline static const auto RemoteHost = QStringLiteral("client/remoteHost");
inline static const auto XdpRestoreToken = QStringLiteral("client/xdpRestoreToken"); inline static const auto XdpRestoreToken = QStringLiteral("client/xdpRestoreToken");
@ -195,6 +196,7 @@ private:
, Settings::Client::LanguageSync , Settings::Client::LanguageSync
, Settings::Client::RemoteHost , Settings::Client::RemoteHost
, Settings::Client::ScrollSpeed , Settings::Client::ScrollSpeed
, Settings::Client::YScrollScale
, Settings::Client::XdpRestoreToken , Settings::Client::XdpRestoreToken
, Settings::Core::CoreMode , Settings::Core::CoreMode
, Settings::Core::Interface , Settings::Core::Interface

View file

@ -7,13 +7,14 @@
#include "deskflow/PlatformScreen.h" #include "deskflow/PlatformScreen.h"
#include "base/DirectionTypes.h" #include "base/DirectionTypes.h"
#include "common/Settings.h"
#include "deskflow/App.h" #include "deskflow/App.h"
PlatformScreen::PlatformScreen(IEventQueue *events, bool invertScrolling) PlatformScreen::PlatformScreen(IEventQueue *events, bool invertScrolling)
: IPlatformScreen(events), : IPlatformScreen(events),
m_invertScrollDirection(invertScrolling) m_invertScrollDirection(invertScrolling)
{ {
// do nothing m_scrollScale = std::clamp(Settings::value(Settings::Client::YScrollScale).toDouble(), 0.1, 10.0);
} }
void PlatformScreen::updateKeyMap() void PlatformScreen::updateKeyMap()
@ -91,6 +92,7 @@ void PlatformScreen::clearStaleModifiers()
int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const
{ {
x *= m_scrollScale;
return (m_invertScrollDirection ? -x : x); return (m_invertScrollDirection ? -x : x);
} }

View file

@ -114,4 +114,11 @@ private:
* This member is used only on client side. * This member is used only on client side.
*/ */
bool m_invertScrollDirection = false; bool m_invertScrollDirection = false;
/**
* @brief m_scrollScale
* This member is used to scale the scroll speed
* It is only used on the client side
*/
double m_scrollScale = 1.0;
}; };

View file

@ -186,7 +186,7 @@ void SettingsDialog::accept()
Settings::setValue(Settings::Gui::CloseToTray, ui->cbCloseToTray->isChecked()); Settings::setValue(Settings::Gui::CloseToTray, ui->cbCloseToTray->isChecked());
Settings::setValue(Settings::Gui::SymbolicTrayIcon, ui->rbIconMono->isChecked()); Settings::setValue(Settings::Gui::SymbolicTrayIcon, ui->rbIconMono->isChecked());
Settings::setValue(Settings::Security::CheckPeers, ui->cbRequireClientCert->isChecked()); Settings::setValue(Settings::Security::CheckPeers, ui->cbRequireClientCert->isChecked());
Settings::setValue(Settings::Client::ScrollSpeed, ui->sbScrollSpeed->value()); Settings::setValue(Settings::Client::YScrollScale, ui->sbYScrollScale->value());
Settings::setValue(Settings::Core::Language, I18N::nativeTo639Name(ui->comboLanguage->currentText())); Settings::setValue(Settings::Core::Language, I18N::nativeTo639Name(ui->comboLanguage->currentText()));
Settings::setValue(Settings::Log::GuiDebug, ui->cbGuiDebug->isChecked()); Settings::setValue(Settings::Log::GuiDebug, ui->cbGuiDebug->isChecked());
Settings::setValue(Settings::Core::UseWlClipboard, ui->cbUseWlClipboard->isChecked()); Settings::setValue(Settings::Core::UseWlClipboard, ui->cbUseWlClipboard->isChecked());
@ -215,7 +215,7 @@ void SettingsDialog::loadFromConfig()
ui->cbCloseToTray->setChecked(Settings::value(Settings::Gui::CloseToTray).toBool()); ui->cbCloseToTray->setChecked(Settings::value(Settings::Gui::CloseToTray).toBool());
ui->cbElevateDaemon->setChecked(Settings::value(Settings::Daemon::Elevate).toBool()); ui->cbElevateDaemon->setChecked(Settings::value(Settings::Daemon::Elevate).toBool());
ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::AutoUpdateCheck).toBool()); ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::AutoUpdateCheck).toBool());
ui->sbScrollSpeed->setValue(Settings::value(Settings::Client::ScrollSpeed).toInt()); ui->sbYScrollScale->setValue(Settings::value(Settings::Client::YScrollScale).toDouble());
ui->cbGuiDebug->setChecked(Settings::value(Settings::Log::GuiDebug).toBool()); ui->cbGuiDebug->setChecked(Settings::value(Settings::Log::GuiDebug).toBool());
ui->cbUseWlClipboard->setChecked(Settings::value(Settings::Core::UseWlClipboard).toBool()); ui->cbUseWlClipboard->setChecked(Settings::value(Settings::Core::UseWlClipboard).toBool());
ui->cbShowVersion->setChecked(Settings::value(Settings::Gui::ShowVersionInTitle).toBool()); ui->cbShowVersion->setChecked(Settings::value(Settings::Gui::ShowVersionInTitle).toBool());

View file

@ -55,38 +55,69 @@
<item> <item>
<widget class="QCheckBox" name="cbScrollDirection"> <widget class="QCheckBox" name="cbScrollDirection">
<property name="text"> <property name="text">
<string>Invert scroll direction on this computer</string> <string>Invert vertical scroll direction on this computer</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QFormLayout" name="formLayout"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item row="0" column="0"> <item>
<widget class="QLabel" name="lblScrollSpeed"> <widget class="QLabel" name="lblScrollSpeed">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Scroll Speed</string> <string>Vertical Scroll Scale</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<widget class="QSpinBox" name="sbScrollSpeed"> <widget class="QDoubleSpinBox" name="sbYScrollScale">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="wrapping">
<bool>true</bool>
</property>
<property name="accelerated"> <property name="accelerated">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectionMode::CorrectToNearestValue</enum>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <double>0.100000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>1000</number> <double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View file

@ -1112,14 +1112,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Use server&apos;s keyboard language on this computer</source> <source>Use server&apos;s keyboard language on this computer</source>
<translation type="unfinished">Utilice el idioma del teclado del servidor en esta computadora</translation> <translation type="unfinished">Utilice el idioma del teclado del servidor en esta computadora</translation>
</message> </message>
<message>
<source>Invert scroll direction on this computer</source>
<translation type="unfinished">Invertir la dirección de desplazamiento en esta computadora</translation>
</message>
<message>
<source>Scroll Speed</source>
<translation type="unfinished">Velocidad de desplazamiento</translation>
</message>
<message> <message>
<source>App</source> <source>App</source>
<translation type="unfinished">Aplicación</translation> <translation type="unfinished">Aplicación</translation>
@ -1324,6 +1316,14 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Include version in the window title</source> <source>Include version in the window title</source>
<translation type="unfinished">Incluir la versión en el título de la ventana</translation> <translation type="unfinished">Incluir la versión en el título de la ventana</translation>
</message> </message>
<message>
<source>Invert vertical scroll direction on this computer</source>
<translation type="unfinished">Invertir la dirección del desplazamiento vertical en este ordenador</translation>
</message>
<message>
<source>Vertical Scroll Scale</source>
<translation type="unfinished">Escala de desplazamiento vertical</translation>
</message>
</context> </context>
<context> <context>
<name>i18n</name> <name>i18n</name>

View file

@ -1112,14 +1112,6 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Use server&apos;s keyboard language on this computer</source> <source>Use server&apos;s keyboard language on this computer</source>
<translation>Usa la lingua della tastiera del server su questo computer</translation> <translation>Usa la lingua della tastiera del server su questo computer</translation>
</message> </message>
<message>
<source>Invert scroll direction on this computer</source>
<translation>Inverti la direzione di scorrimento su questo computer</translation>
</message>
<message>
<source>Scroll Speed</source>
<translation>Velocità di scorrimento</translation>
</message>
<message> <message>
<source>App</source> <source>App</source>
<translation>App</translation> <translation>App</translation>
@ -1324,6 +1316,14 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Include version in the window title</source> <source>Include version in the window title</source>
<translation type="unfinished">Includi la versione nel titolo della finestra</translation> <translation type="unfinished">Includi la versione nel titolo della finestra</translation>
</message> </message>
<message>
<source>Invert vertical scroll direction on this computer</source>
<translation type="unfinished">Inverti la direzione dello scorrimento verticale su questo computer</translation>
</message>
<message>
<source>Vertical Scroll Scale</source>
<translation type="unfinished">Scala di scorrimento verticale</translation>
</message>
</context> </context>
<context> <context>
<name>i18n</name> <name>i18n</name>

View file

@ -1113,14 +1113,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Use server&apos;s keyboard language on this computer</source> <source>Use server&apos;s keyboard language on this computer</source>
<translation>サーバー側のキーボード言語をこのコンピューターで使用する</translation> <translation>サーバー側のキーボード言語をこのコンピューターで使用する</translation>
</message> </message>
<message>
<source>Invert scroll direction on this computer</source>
<translation>このコンピューターのスクロール方向を反転する</translation>
</message>
<message>
<source>Scroll Speed</source>
<translation>スクロール速度</translation>
</message>
<message> <message>
<source>App</source> <source>App</source>
<translation>アプリケーション</translation> <translation>アプリケーション</translation>
@ -1325,6 +1317,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source> <source>Include version in the window title</source>
<translation type="unfinished">ウィンドウタイトルにバージョン情報を含める</translation> <translation type="unfinished">ウィンドウタイトルにバージョン情報を含める</translation>
</message> </message>
<message>
<source>Invert vertical scroll direction on this computer</source>
<translation type="unfinished">このコンピューターで垂直スクロールの方向を反転させる</translation>
</message>
<message>
<source>Vertical Scroll Scale</source>
<translation type="unfinished">垂直スクロールスケール</translation>
</message>
</context> </context>
<context> <context>
<name>i18n</name> <name>i18n</name>

View file

@ -1111,14 +1111,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Use server&apos;s keyboard language on this computer</source> <source>Use server&apos;s keyboard language on this computer</source>
<translation>이 컴퓨터에서 서버의 키보드 언어 사용</translation> <translation>이 컴퓨터에서 서버의 키보드 언어 사용</translation>
</message> </message>
<message>
<source>Invert scroll direction on this computer</source>
<translation>이 컴퓨터의 스크롤 방향 반전</translation>
</message>
<message>
<source>Scroll Speed</source>
<translation>스크롤 속도</translation>
</message>
<message> <message>
<source>App</source> <source>App</source>
<translation>앱</translation> <translation>앱</translation>
@ -1323,6 +1315,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source> <source>Include version in the window title</source>
<translation type="unfinished">창 제목에 버전 정보 포함</translation> <translation type="unfinished">창 제목에 버전 정보 포함</translation>
</message> </message>
<message>
<source>Invert vertical scroll direction on this computer</source>
<translation type="unfinished">이 컴퓨터에서 세로 스크롤 방향을 반전합니다</translation>
</message>
<message>
<source>Vertical Scroll Scale</source>
<translation type="unfinished">수직 스크롤 스케일</translation>
</message>
</context> </context>
<context> <context>
<name>i18n</name> <name>i18n</name>

View file

@ -1111,14 +1111,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Use server&apos;s keyboard language on this computer</source> <source>Use server&apos;s keyboard language on this computer</source>
<translation>Использовать язык клавиатуры сервера на этом компьютере</translation> <translation>Использовать язык клавиатуры сервера на этом компьютере</translation>
</message> </message>
<message>
<source>Invert scroll direction on this computer</source>
<translation>Инвертировать направление прокрутки на этом компьютере</translation>
</message>
<message>
<source>Scroll Speed</source>
<translation>Скорость прокрутки</translation>
</message>
<message> <message>
<source>App</source> <source>App</source>
<translation>Приложение</translation> <translation>Приложение</translation>
@ -1323,6 +1315,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source> <source>Include version in the window title</source>
<translation type="unfinished">Включить номер версии в заголовок окна</translation> <translation type="unfinished">Включить номер версии в заголовок окна</translation>
</message> </message>
<message>
<source>Invert vertical scroll direction on this computer</source>
<translation type="unfinished">Инвертировать направление вертикальной прокрутки на этом компьютере</translation>
</message>
<message>
<source>Vertical Scroll Scale</source>
<translation type="unfinished">Вертикальная шкала прокрутки</translation>
</message>
</context> </context>
<context> <context>
<name>i18n</name> <name>i18n</name>

View file

@ -1113,14 +1113,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Use server&apos;s keyboard language on this computer</source> <source>Use server&apos;s keyboard language on this computer</source>
<translation>在此计算机上使用服务器的键盘语言</translation> <translation>在此计算机上使用服务器的键盘语言</translation>
</message> </message>
<message>
<source>Invert scroll direction on this computer</source>
<translation>反转此计算机上的滚动方向</translation>
</message>
<message>
<source>Scroll Speed</source>
<translation>滚动速度</translation>
</message>
<message> <message>
<source>App</source> <source>App</source>
<translation>应用程序</translation> <translation>应用程序</translation>
@ -1325,6 +1317,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source> <source>Include version in the window title</source>
<translation type="unfinished">在窗口标题中包含版本信息</translation> <translation type="unfinished">在窗口标题中包含版本信息</translation>
</message> </message>
<message>
<source>Invert vertical scroll direction on this computer</source>
<translation type="unfinished">在此计算机上反转垂直滚动方向</translation>
</message>
<message>
<source>Vertical Scroll Scale</source>
<translation type="unfinished">垂直滚动比例</translation>
</message>
</context> </context>
<context> <context>
<name>i18n</name> <name>i18n</name>