fix: Pass ClientScrollDirection to EiScreen

This commit is contained in:
Zhuofeng Wang 2025-08-26 15:43:41 +08:00 committed by Chris Rizzitello
parent ddadd4ad83
commit 927075688c
3 changed files with 11 additions and 4 deletions

View file

@ -170,7 +170,9 @@ 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), getEvents()); return new deskflow::Screen(
new deskflow::EiScreen(false, getEvents(), true, args().m_clientScrollDirection), getEvents()
);
#else #else
throw XNoEiSupport(); throw XNoEiSupport();
#endif #endif

View file

@ -38,8 +38,8 @@ struct ScrollRemainder
namespace deskflow { namespace deskflow {
EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal) EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal, deskflow::ClientScrollDirection scrollDirection)
: PlatformScreen{events}, : PlatformScreen{events, scrollDirection},
m_isPrimary{isPrimary}, m_isPrimary{isPrimary},
m_events{events}, m_events{events},
m_w{1}, m_w{1},
@ -304,6 +304,8 @@ void EiScreen::fakeMouseWheel(int32_t xDelta, int32_t yDelta) const
if (!m_eiPointer) if (!m_eiPointer)
return; return;
xDelta = mapClientScrollDirection(xDelta);
yDelta = mapClientScrollDirection(yDelta);
// libei and deskflow seem to use opposite directions, so we have // 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 // to send EI the opposite of the value received if we want to remain
// compatible with other platforms (including X11). // compatible with other platforms (including X11).

View file

@ -32,7 +32,10 @@ class PortalInputCapture;
class EiScreen : public PlatformScreen class EiScreen : public PlatformScreen
{ {
public: public:
EiScreen(bool isPrimary, IEventQueue *events, bool usePortal); EiScreen(
bool isPrimary, IEventQueue *events, bool usePortal,
deskflow::ClientScrollDirection scrollDirection = deskflow::ClientScrollDirection::Normal
);
~EiScreen() override; ~EiScreen() override;
// IScreen overrides // IScreen overrides