1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 00:45:07 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2019-01-10 23:19:29 +01:00
parent 8626e95509
commit f6d2c3ed87
17 changed files with 117 additions and 23 deletions

View file

@ -5,6 +5,11 @@
static EventLoop* s_mainEventLoop;
void EventLoop::initialize()
{
s_mainEventLoop = nullptr;
}
EventLoop::EventLoop()
{
if (!s_mainEventLoop)
@ -26,7 +31,7 @@ int EventLoop::exec()
for (;;) {
if (m_queuedEvents.is_empty())
waitForEvent();
auto events = std::move(m_queuedEvents);
auto events = move(m_queuedEvents);
for (auto& queuedEvent : events) {
auto* receiver = queuedEvent.receiver;
auto& event = *queuedEvent.event;
@ -48,9 +53,16 @@ int EventLoop::exec()
void EventLoop::postEvent(Object* receiver, OwnPtr<Event>&& event)
{
m_queuedEvents.append({ receiver, std::move(event) });
printf("EventLoop::postEvent: {%u} << receiver=%p, event=%p\n", m_queuedEvents.size(), receiver, event.ptr());
m_queuedEvents.append({ receiver, move(event) });
}
#ifdef SERENITY
void EventLoop::waitForEvent()
{
}
#endif
#ifdef USE_SDL
static inline MouseButton toMouseButton(byte sdlButton)
{
@ -119,7 +131,7 @@ void EventLoop::handleKeyEvent(Event::Type type, const SDL_KeyboardEvent& sdlKey
keyEvent->m_ctrl = sdlKey.keysym.mod & KMOD_CTRL;
keyEvent->m_alt = sdlKey.keysym.mod & KMOD_ALT;
postEvent(&WindowManager::the(), std::move(keyEvent));
postEvent(&WindowManager::the(), move(keyEvent));
}
void EventLoop::waitForEvent()