mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-07 07:31:53 -07:00
@@ -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<CEventLoopTimer> 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<void()>& fn);
|
||||
|
||||
struct SIdleData {
|
||||
wl_event_source* eventSource = nullptr;
|
||||
std::vector<std::function<void()>> fns;
|
||||
};
|
||||
|
||||
private:
|
||||
struct {
|
||||
wl_event_loop* loop = nullptr;
|
||||
@@ -34,6 +42,8 @@ class CEventLoopManager {
|
||||
std::vector<SP<CEventLoopTimer>> timers;
|
||||
int timerfd = -1;
|
||||
} m_sTimers;
|
||||
|
||||
SIdleData m_sIdle;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CEventLoopManager> g_pEventLoopManager;
|
Reference in New Issue
Block a user