1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 09:17:35 +00:00
serenity/LibGUI/EventLoop.h
2019-01-19 23:49:56 +01:00

37 lines
666 B
C++

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