From 927075688cd1b28375c2eb3a971bc16ef2ad5d4b Mon Sep 17 00:00:00 2001 From: Zhuofeng Wang Date: Tue, 26 Aug 2025 15:43:41 +0800 Subject: [PATCH] fix: Pass ClientScrollDirection to EiScreen --- src/lib/deskflow/ClientApp.cpp | 4 +++- src/lib/platform/EiScreen.cpp | 6 ++++-- src/lib/platform/EiScreen.h | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/deskflow/ClientApp.cpp b/src/lib/deskflow/ClientApp.cpp index db2f0a754..e0a2199fd 100644 --- a/src/lib/deskflow/ClientApp.cpp +++ b/src/lib/deskflow/ClientApp.cpp @@ -170,7 +170,9 @@ deskflow::Screen *ClientApp::createScreen() if (deskflow::platform::isWayland()) { #if WINAPI_LIBEI LOG_INFO("using ei screen for wayland"); - return new deskflow::Screen(new deskflow::EiScreen(false, getEvents(), true), getEvents()); + return new deskflow::Screen( + new deskflow::EiScreen(false, getEvents(), true, args().m_clientScrollDirection), getEvents() + ); #else throw XNoEiSupport(); #endif diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index ab505db09..cd22179e5 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -38,8 +38,8 @@ struct ScrollRemainder namespace deskflow { -EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal) - : PlatformScreen{events}, +EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal, deskflow::ClientScrollDirection scrollDirection) + : PlatformScreen{events, scrollDirection}, m_isPrimary{isPrimary}, m_events{events}, m_w{1}, @@ -304,6 +304,8 @@ void EiScreen::fakeMouseWheel(int32_t xDelta, int32_t yDelta) const if (!m_eiPointer) return; + xDelta = mapClientScrollDirection(xDelta); + yDelta = mapClientScrollDirection(yDelta); // libei and deskflow seem to use opposite directions, so we have // to send EI the opposite of the value received if we want to remain // compatible with other platforms (including X11). diff --git a/src/lib/platform/EiScreen.h b/src/lib/platform/EiScreen.h index da2520fa4..3c7e88c1b 100644 --- a/src/lib/platform/EiScreen.h +++ b/src/lib/platform/EiScreen.h @@ -32,7 +32,10 @@ class PortalInputCapture; class EiScreen : public PlatformScreen { public: - EiScreen(bool isPrimary, IEventQueue *events, bool usePortal); + EiScreen( + bool isPrimary, IEventQueue *events, bool usePortal, + deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal + ); ~EiScreen() override; // IScreen overrides