diff --git a/src/lib/deskflow/ArgParser.cpp b/src/lib/deskflow/ArgParser.cpp index 18e01a5e1..8c1e547f3 100644 --- a/src/lib/deskflow/ArgParser.cpp +++ b/src/lib/deskflow/ArgParser.cpp @@ -87,7 +87,7 @@ bool ArgParser::parseClientArgs(deskflow::ClientArgs &args, int argc, const char } else if (isArg(i, argc, argv, nullptr, "--sync-language")) { args.m_enableLangSync = true; } else if (isArg(i, argc, argv, nullptr, "--invert-scroll")) { - args.m_clientScrollDirection = deskflow::ClientScrollDirection::INVERT_SERVER; + args.m_clientScrollDirection = deskflow::ClientScrollDirection::Inverted; } else if (isArg(i, argc, argv, nullptr, "client")) { ++i; continue; diff --git a/src/lib/deskflow/ClientArgs.h b/src/lib/deskflow/ClientArgs.h index a8892815b..55fefd0e4 100644 --- a/src/lib/deskflow/ClientArgs.h +++ b/src/lib/deskflow/ClientArgs.h @@ -9,10 +9,10 @@ #include "ArgsBase.h" namespace deskflow { -enum ClientScrollDirection +enum class ClientScrollDirection { - SERVER = 1, - INVERT_SERVER = -1 + Normal = 1, //!< Same direction as the server + Inverted = -1 //!< Inverted scroll direction from the server }; class ClientArgs : public ArgsBase @@ -32,7 +32,7 @@ public: * @brief m_clientScrollDirection * This option is responcible for scroll direction on client side. */ - ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::SERVER; + ClientScrollDirection m_clientScrollDirection = ClientScrollDirection::Normal; /** * @brief m_serverAddress stores deskflow server address diff --git a/src/lib/deskflow/PlatformScreen.cpp b/src/lib/deskflow/PlatformScreen.cpp index b349563ac..3ae6f3605 100644 --- a/src/lib/deskflow/PlatformScreen.cpp +++ b/src/lib/deskflow/PlatformScreen.cpp @@ -86,5 +86,5 @@ void PlatformScreen::pollPressedKeys(KeyButtonSet &pressedKeys) const int32_t PlatformScreen::mapClientScrollDirection(int32_t x) const { - return (x * m_clientScrollDirection); + return (x * static_cast(m_clientScrollDirection)); } diff --git a/src/lib/deskflow/PlatformScreen.h b/src/lib/deskflow/PlatformScreen.h index c3a059d9e..e41119262 100644 --- a/src/lib/deskflow/PlatformScreen.h +++ b/src/lib/deskflow/PlatformScreen.h @@ -22,7 +22,7 @@ class PlatformScreen : public IPlatformScreen { public: PlatformScreen( - IEventQueue *events, deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER + IEventQueue *events, deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal ); ~PlatformScreen() override = default; @@ -111,5 +111,5 @@ private: * This member contains client scroll direction. * This member is used only on client side. */ - deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::SERVER; + deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::Normal; }; diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h index d64ae5de6..ffd511c84 100644 --- a/src/lib/platform/MSWindowsScreen.h +++ b/src/lib/platform/MSWindowsScreen.h @@ -32,7 +32,7 @@ class MSWindowsScreen : public PlatformScreen public: MSWindowsScreen( bool isPrimary, bool noHooks, IEventQueue *events, bool enableLangSync = false, - deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER + deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal ); ~MSWindowsScreen() override; diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index 0a4f8efe8..96a5d2a67 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -46,7 +46,7 @@ class OSXScreen : public PlatformScreen public: OSXScreen( IEventQueue *events, bool isPrimary, bool enableLangSync = false, - deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::SERVER + deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal ); virtual ~OSXScreen(); diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h index b01323516..b845a6c29 100644 --- a/src/lib/platform/XWindowsScreen.h +++ b/src/lib/platform/XWindowsScreen.h @@ -29,7 +29,7 @@ class XWindowsScreen : public PlatformScreen public: XWindowsScreen( const char *displayName, bool isPrimary, int mouseScrollDelta, IEventQueue *events, - deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::SERVER + deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::Normal ); ~XWindowsScreen() override; diff --git a/src/unittests/deskflow/ArgParserTests.cpp b/src/unittests/deskflow/ArgParserTests.cpp index 76231af9a..b296f1bc9 100644 --- a/src/unittests/deskflow/ArgParserTests.cpp +++ b/src/unittests/deskflow/ArgParserTests.cpp @@ -244,7 +244,7 @@ void ArgParserTests::client_setInvertScroll() m_parser.parseClientArgs(clientArgs, argc, kLangCmd.data()); - QCOMPARE(clientArgs.m_clientScrollDirection, deskflow::ClientScrollDirection::INVERT_SERVER); + QCOMPARE(clientArgs.m_clientScrollDirection, deskflow::ClientScrollDirection::Inverted); } void ArgParserTests::client_commonArgs()