1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Intense hacking on Widgets.

This commit is contained in:
Andreas Kling 2018-10-10 16:49:36 +02:00
parent 8c84f9749e
commit 6f37429f57
20 changed files with 290 additions and 5 deletions

View file

@ -1,6 +1,8 @@
#include "EventLoopSDL.h"
#include "Event.h"
#include <SDL.h>
#include "AbstractScreen.h"
#include "Widget.h"
EventLoopSDL::EventLoopSDL()
{
@ -18,6 +20,16 @@ void EventLoopSDL::waitForEvent()
case SDL_QUIT:
postEvent(nullptr, make<QuitEvent>());
return;
case SDL_WINDOWEVENT:
if (sdlEvent.window.event == SDL_WINDOWEVENT_EXPOSED) {
// Spam paint events whenever we get exposed.
// This is obviously not ideal, but the SDL backend here is just a prototype anyway.
postEvent(AbstractScreen::the().rootWidget(), make<PaintEvent>());
}
return;
case SDL_MOUSEMOTION:
postEvent(&AbstractScreen::the(), make<MouseEvent>(Event::MouseMove, sdlEvent.motion.x, sdlEvent.motion.y));
return;
}
}
}