#pragma once #include "Event.h" #include #include #ifdef USE_SDL #include #endif class Object; class Process; class EventLoop { public: EventLoop(); ~EventLoop(); int exec(); void postEvent(Object* receiver, OwnPtr&&); static EventLoop& main(); static void initialize(); bool running() const { return m_running; } Process& server_process() { return *m_server_process; } private: void waitForEvent(); #ifdef USE_SDL void handleKeyEvent(Event::Type, const SDL_KeyboardEvent&); #endif struct QueuedEvent { Object* receiver { nullptr }; OwnPtr event; }; Vector m_queuedEvents; Process* m_server_process { nullptr }; bool m_running { false }; };