refactor: check settigns for invertscroll in PlatformScreen

This commit is contained in:
sithlord48 2026-02-05 21:30:30 -05:00 committed by Chris Rizzitello
parent 380f65954d
commit a520e3b2e9
11 changed files with 19 additions and 28 deletions

View file

@ -104,12 +104,11 @@ const char *ClientApp::daemonName() const
deskflow::Screen *ClientApp::createScreen() deskflow::Screen *ClientApp::createScreen()
{ {
const bool invertScrolling = Settings::value(Settings::Client::InvertScrollDirection).toBool();
#if WINAPI_MSWINDOWS #if WINAPI_MSWINDOWS
return new deskflow::Screen( return new deskflow::Screen(
new MSWindowsScreen( new MSWindowsScreen(
false, Settings::value(Settings::Core::UseHooks).toBool(), getEvents(), false, Settings::value(Settings::Core::UseHooks).toBool(), getEvents(),
Settings::value(Settings::Client::LanguageSync).toBool(), invertScrolling Settings::value(Settings::Client::LanguageSync).toBool()
), ),
getEvents() getEvents()
); );
@ -119,7 +118,7 @@ deskflow::Screen *ClientApp::createScreen()
if (deskflow::platform::isWayland()) { if (deskflow::platform::isWayland()) {
#if WINAPI_LIBEI #if WINAPI_LIBEI
LOG_INFO("using ei screen for wayland"); LOG_INFO("using ei screen for wayland");
return new deskflow::Screen(new deskflow::EiScreen(false, getEvents(), true, invertScrolling), getEvents()); return new deskflow::Screen(new deskflow::EiScreen(false, getEvents(), true), getEvents());
#else #else
throw XNoEiSupport(); throw XNoEiSupport();
#endif #endif
@ -129,9 +128,7 @@ deskflow::Screen *ClientApp::createScreen()
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
LOG_INFO("using legacy x windows screen"); LOG_INFO("using legacy x windows screen");
return new deskflow::Screen( return new deskflow::Screen(
new XWindowsScreen( new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), false, getEvents()),
qPrintable(Settings::value(Settings::Core::Display).toString()), false, getEvents(), invertScrolling
),
getEvents() getEvents()
); );
@ -139,8 +136,7 @@ deskflow::Screen *ClientApp::createScreen()
#if WINAPI_CARBON #if WINAPI_CARBON
return new deskflow::Screen( return new deskflow::Screen(
new OSXScreen(getEvents(), false, Settings::value(Settings::Client::LanguageSync).toBool(), invertScrolling), new OSXScreen(getEvents(), false, Settings::value(Settings::Client::LanguageSync).toBool()), getEvents()
getEvents()
); );
#endif #endif
} }

View file

@ -10,10 +10,9 @@
#include "common/Settings.h" #include "common/Settings.h"
#include "deskflow/App.h" #include "deskflow/App.h"
PlatformScreen::PlatformScreen(IEventQueue *events, bool invertScrolling) PlatformScreen::PlatformScreen(IEventQueue *events) : IPlatformScreen(events)
: IPlatformScreen(events),
m_invertScrollDirection(invertScrolling)
{ {
m_invertScrollDirection = Settings::value(Settings::Client::InvertScrollDirection).toBool();
m_yScrollScale = std::clamp(Settings::value(Settings::Client::YScrollScale).toDouble(), 0.1, 10.0); m_yScrollScale = std::clamp(Settings::value(Settings::Client::YScrollScale).toDouble(), 0.1, 10.0);
} }

View file

@ -23,7 +23,7 @@ public:
int32_t xDelta; int32_t xDelta;
int32_t yDelta; int32_t yDelta;
}; };
explicit PlatformScreen(IEventQueue *events, bool invertScrollDirection); explicit PlatformScreen(IEventQueue *events);
~PlatformScreen() override = default; ~PlatformScreen() override = default;
// IScreen overrides // IScreen overrides

View file

@ -36,8 +36,8 @@ struct ScrollRemainder
namespace deskflow { namespace deskflow {
EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal, bool invertScrolling) EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal)
: PlatformScreen{events, invertScrolling}, : PlatformScreen{events},
m_isPrimary{isPrimary}, m_isPrimary{isPrimary},
m_events{events}, m_events{events},
m_clipboard{new WlClipboardCollection()}, m_clipboard{new WlClipboardCollection()},

View file

@ -34,7 +34,7 @@ using ClipboardInfo = IScreen::ClipboardInfo;
class EiScreen : public PlatformScreen class EiScreen : public PlatformScreen
{ {
public: public:
EiScreen(bool isPrimary, IEventQueue *events, bool usePortal, bool invertScrolling = false); EiScreen(bool isPrimary, IEventQueue *events, bool usePortal);
~EiScreen() override; ~EiScreen() override;
// IScreen overrides // IScreen overrides

View file

@ -79,10 +79,8 @@
HINSTANCE MSWindowsScreen::s_windowInstance = nullptr; HINSTANCE MSWindowsScreen::s_windowInstance = nullptr;
MSWindowsScreen *MSWindowsScreen::s_screen = nullptr; MSWindowsScreen *MSWindowsScreen::s_screen = nullptr;
MSWindowsScreen::MSWindowsScreen( MSWindowsScreen::MSWindowsScreen(bool isPrimary, bool useHooks, IEventQueue *events, bool enableLangSync)
bool isPrimary, bool useHooks, IEventQueue *events, bool enableLangSync, bool invertScrolling : PlatformScreen(events),
)
: PlatformScreen(events, invertScrolling),
m_isPrimary(isPrimary), m_isPrimary(isPrimary),
m_useHooks(useHooks), m_useHooks(useHooks),
m_isOnScreen(m_isPrimary), m_isOnScreen(m_isPrimary),

View file

@ -29,9 +29,7 @@ class MSWindowsDropTarget;
class MSWindowsScreen : public PlatformScreen class MSWindowsScreen : public PlatformScreen
{ {
public: public:
MSWindowsScreen( MSWindowsScreen(bool isPrimary, bool useHooks, IEventQueue *events, bool enableLangSync = false);
bool isPrimary, bool useHooks, IEventQueue *events, bool enableLangSync = false, bool invetScrolling = false
);
~MSWindowsScreen() override; ~MSWindowsScreen() override;
//! @name manipulators //! @name manipulators

View file

@ -43,7 +43,7 @@ class Mutex;
class OSXScreen : public PlatformScreen class OSXScreen : public PlatformScreen
{ {
public: public:
OSXScreen(IEventQueue *events, bool isPrimary, bool enableLangSync = false, bool invertScrolling = false); OSXScreen(IEventQueue *events, bool isPrimary, bool enableLangSync = false);
virtual ~OSXScreen(); virtual ~OSXScreen();

View file

@ -74,8 +74,8 @@ void avoidHesitatingCursor();
bool OSXScreen::s_testedForGHOM = false; bool OSXScreen::s_testedForGHOM = false;
bool OSXScreen::s_hasGHOM = false; bool OSXScreen::s_hasGHOM = false;
OSXScreen::OSXScreen(IEventQueue *events, bool isPrimary, bool enableLangSync, bool invertScrolling) OSXScreen::OSXScreen(IEventQueue *events, bool isPrimary, bool enableLangSync)
: PlatformScreen(events, invertScrolling), : PlatformScreen(events),
m_isPrimary(isPrimary), m_isPrimary(isPrimary),
m_isOnScreen(m_isPrimary), m_isOnScreen(m_isPrimary),
m_cursorPosValid(false), m_cursorPosValid(false),

View file

@ -82,8 +82,8 @@ static int xi_opcode;
XWindowsScreen *XWindowsScreen::s_screen = nullptr; XWindowsScreen *XWindowsScreen::s_screen = nullptr;
XWindowsScreen::XWindowsScreen(const char *displayName, bool isPrimary, IEventQueue *events, bool invertScrolling) XWindowsScreen::XWindowsScreen(const char *displayName, bool isPrimary, IEventQueue *events)
: PlatformScreen(events, invertScrolling), : PlatformScreen(events),
m_isPrimary(isPrimary), m_isPrimary(isPrimary),
m_isOnScreen(m_isPrimary), m_isOnScreen(m_isPrimary),
m_events(events) m_events(events)

View file

@ -28,7 +28,7 @@ class XWindowsScreenSaver;
class XWindowsScreen : public PlatformScreen class XWindowsScreen : public PlatformScreen
{ {
public: public:
XWindowsScreen(const char *displayName, bool isPrimary, IEventQueue *events, bool invertScrolling = false); XWindowsScreen(const char *displayName, bool isPrimary, IEventQueue *events);
~XWindowsScreen() override; ~XWindowsScreen() override;
//! @name manipulators //! @name manipulators