From 8b728612a9df4ad46093fbcdf659822ba85a42b8 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Tue, 24 Sep 2024 00:48:00 +0100 Subject: [PATCH] Session: only dispatch udev in dispatchPendingEventsAsync if on linux (#86) --- src/backend/Backend.cpp | 3 +++ src/backend/Session.cpp | 24 ++++++------------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/backend/Backend.cpp b/src/backend/Backend.cpp index b78226c..32651ac 100644 --- a/src/backend/Backend.cpp +++ b/src/backend/Backend.cpp @@ -166,6 +166,9 @@ bool Aquamarine::CBackend::start() { b->onReady(); } + if (session) + session->onReady(); + sessionFDs = session ? session->pollFDs() : std::vector>{}; return true; diff --git a/src/backend/Session.cpp b/src/backend/Session.cpp index 6465e5d..6d47aaa 100644 --- a/src/backend/Session.cpp +++ b/src/backend/Session.cpp @@ -264,24 +264,7 @@ static bool isDRMCard(const char* sysname) { } void Aquamarine::CSession::onReady() { - for (auto const& d : libinputDevices) { - if (d->keyboard) - backend->events.newKeyboard.emit(SP(d->keyboard)); - if (d->mouse) - backend->events.newPointer.emit(SP(d->mouse)); - if (d->touch) - backend->events.newTouch.emit(SP(d->touch)); - if (d->switchy) - backend->events.newSwitch.emit(SP(d->touch)); - if (d->tablet) - backend->events.newTablet.emit(SP(d->tablet)); - if (d->tabletPad) - backend->events.newTabletPad.emit(SP(d->tabletPad)); - - for (auto const& t : d->tabletTools) { - backend->events.newTabletTool.emit(SP(t)); - } - } + ; } void Aquamarine::CSession::dispatchUdevEvents() { @@ -377,7 +360,12 @@ void Aquamarine::CSession::dispatchLibseatEvents() { void Aquamarine::CSession::dispatchPendingEventsAsync() { dispatchLibseatEvents(); + + // only linux libudev allows us to asynchronously dispatch outstanding without blocking +#if defined(__linux__) dispatchUdevEvents(); +#endif + dispatchLibinputEvents(); }