From cc98594c3aed0b542e03818371a4636f549f80e1 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 5 Jul 2024 23:05:03 +0200 Subject: pointer: update geometry after unplug events fixes #6700 fixes #6740 --- src/managers/eventLoop/EventLoopManager.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/managers/eventLoop/EventLoopManager.hpp') diff --git a/src/managers/eventLoop/EventLoopManager.hpp b/src/managers/eventLoop/EventLoopManager.hpp index 7a4fa19e..0b2f9578 100644 --- a/src/managers/eventLoop/EventLoopManager.hpp +++ b/src/managers/eventLoop/EventLoopManager.hpp @@ -9,10 +9,10 @@ class CEventLoopManager { public: - CEventLoopManager(); + CEventLoopManager(wl_display* display, wl_event_loop* wlEventLoop); ~CEventLoopManager(); - void enterLoop(wl_display* display, wl_event_loop* wlEventLoop); + void enterLoop(); // Note: will remove the timer if the ptr is lost. void addTimer(SP timer); @@ -23,6 +23,14 @@ class CEventLoopManager { // recalculates timers void nudgeTimers(); + // schedules a function to run later, aka in a wayland idle event. + void doLater(const std::function& fn); + + struct SIdleData { + wl_event_source* eventSource = nullptr; + std::vector> fns; + }; + private: struct { wl_event_loop* loop = nullptr; @@ -34,6 +42,8 @@ class CEventLoopManager { std::vector> timers; int timerfd = -1; } m_sTimers; + + SIdleData m_sIdle; }; inline std::unique_ptr g_pEventLoopManager; \ No newline at end of file -- cgit v1.2.3