mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
More hacking on Widgets.
This commit is contained in:
@@ -12,6 +12,19 @@ EventLoopSDL::~EventLoopSDL()
|
||||
{
|
||||
}
|
||||
|
||||
static inline MouseButton toMouseButton(byte sdlButton)
|
||||
{
|
||||
printf("sdlbutton = %u\n", sdlButton);
|
||||
if (sdlButton == 1)
|
||||
return MouseButton::Left;
|
||||
if (sdlButton == 2)
|
||||
return MouseButton::Middle;
|
||||
if (sdlButton == 3)
|
||||
return MouseButton::Right;
|
||||
ASSERT_NOT_REACHED();
|
||||
return MouseButton::None;
|
||||
}
|
||||
|
||||
void EventLoopSDL::waitForEvent()
|
||||
{
|
||||
SDL_Event sdlEvent;
|
||||
@@ -30,6 +43,9 @@ void EventLoopSDL::waitForEvent()
|
||||
case SDL_MOUSEMOTION:
|
||||
postEvent(&AbstractScreen::the(), make<MouseEvent>(Event::MouseMove, sdlEvent.motion.x, sdlEvent.motion.y));
|
||||
return;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
postEvent(&AbstractScreen::the(), make<MouseEvent>(Event::MouseDown, sdlEvent.button.x, sdlEvent.button.y, toMouseButton(sdlEvent.button.button)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user