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 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

View File

@ -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).

View File

@ -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