diff --git a/src/managers/eventLoop/EventLoopManager.cpp b/src/managers/eventLoop/EventLoopManager.cpp index dd52b968..ed7a4f72 100644 --- a/src/managers/eventLoop/EventLoopManager.cpp +++ b/src/managers/eventLoop/EventLoopManager.cpp @@ -8,6 +8,8 @@ #include #include +#include + #define TIMESPEC_NSEC_PER_SEC 1000000000L CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEventLoop) { @@ -27,16 +29,18 @@ static int timerWrite(int fd, uint32_t mask, void* data) { } static int aquamarineFDWrite(int fd, uint32_t mask, void* data) { - g_pCompositor->m_pAqBackend->dispatchEventsAsync(); + auto POLLFD = (Aquamarine::SPollFD*)data; + POLLFD->onSignal(); return 1; } void CEventLoopManager::enterLoop() { m_sWayland.eventSource = wl_event_loop_add_fd(m_sWayland.loop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr); - auto aqFDs = g_pCompositor->m_pAqBackend->getPollFDs(); - for (auto& fd : aqFDs) { - m_sWayland.aqEventSources.emplace_back(wl_event_loop_add_fd(m_sWayland.loop, fd, WL_EVENT_READABLE, aquamarineFDWrite, nullptr)); + aqPollFDs = g_pCompositor->m_pAqBackend->getPollFDs(); + for (auto& fd : aqPollFDs) { + m_sWayland.aqEventSources.emplace_back(wl_event_loop_add_fd(m_sWayland.loop, fd->fd, WL_EVENT_READABLE, aquamarineFDWrite, fd.get())); + fd->onSignal(); // dispatch outstanding } wl_display_run(m_sWayland.display); diff --git a/src/managers/eventLoop/EventLoopManager.hpp b/src/managers/eventLoop/EventLoopManager.hpp index 7758bdf6..d5b640a3 100644 --- a/src/managers/eventLoop/EventLoopManager.hpp +++ b/src/managers/eventLoop/EventLoopManager.hpp @@ -7,6 +7,10 @@ #include "EventLoopTimer.hpp" +namespace Aquamarine { + struct SPollFD; +}; + class CEventLoopManager { public: CEventLoopManager(wl_display* display, wl_event_loop* wlEventLoop); @@ -45,6 +49,7 @@ class CEventLoopManager { } m_sTimers; SIdleData m_sIdle; + std::vector> aqPollFDs; }; inline std::unique_ptr g_pEventLoopManager; \ No newline at end of file