summaryrefslogtreecommitdiff
path: root/src/managers/eventLoop/EventLoopManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/managers/eventLoop/EventLoopManager.cpp')
-rw-r--r--src/managers/eventLoop/EventLoopManager.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/managers/eventLoop/EventLoopManager.cpp b/src/managers/eventLoop/EventLoopManager.cpp
index 0d1b0223..ed7a4f72 100644
--- a/src/managers/eventLoop/EventLoopManager.cpp
+++ b/src/managers/eventLoop/EventLoopManager.cpp
@@ -1,5 +1,6 @@
#include "EventLoopManager.hpp"
#include "../../debug/Log.hpp"
+#include "../../Compositor.hpp"
#include <algorithm>
#include <limits>
@@ -7,6 +8,8 @@
#include <sys/timerfd.h>
#include <time.h>
+#include <aquamarine/backend/Backend.hpp>
+
#define TIMESPEC_NSEC_PER_SEC 1000000000L
CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEventLoop) {
@@ -25,9 +28,21 @@ static int timerWrite(int fd, uint32_t mask, void* data) {
return 1;
}
+static int aquamarineFDWrite(int fd, uint32_t mask, void* data) {
+ 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);
+ 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);
Debug::log(LOG, "Kicked off the event loop! :(");