Files
ladybird/Widgets/EventLoop.h
Andreas Kling f6d2c3ed87 Hook everything up to run the GUI on top of the kernel.
Okay things kinda sorta work. Both Bochs and QEMU now boot into GUI mode.
There's a ton of stuff that doesn't make sense and so many things to rework.

Still it's quite cool to have made it this far. :^)
2019-01-10 23:19:29 +01:00

39 lines
596 B
C++

#pragma once
#include "Event.h"
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#ifdef USE_SDL
#include <SDL.h>
#endif
class Object;
class EventLoop {
public:
EventLoop();
~EventLoop();
int exec();
void postEvent(Object* receiver, OwnPtr<Event>&&);
static EventLoop& main();
static void initialize();
private:
void waitForEvent();
#ifdef USE_SDL
void handleKeyEvent(Event::Type, const SDL_KeyboardEvent&);
#endif
struct QueuedEvent {
Object* receiver { nullptr };
OwnPtr<Event> event;
};
Vector<QueuedEvent> m_queuedEvents;
};