1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

LibGUI: Hook up GWindow event dispatch for paint and mouse events.

This commit is contained in:
Andreas Kling 2019-01-20 07:03:38 +01:00
parent dbe83f3a83
commit ea6678b7b3
9 changed files with 72 additions and 30 deletions

View file

@ -29,10 +29,10 @@ void WSWindow::set_rect(const Rect& rect)
{
if (m_rect == rect)
return;
auto oldRect = m_rect;
auto old_rect = m_rect;
m_rect = rect;
m_backing = GraphicsBitmap::create(m_process, m_rect.size());
WSWindowManager::the().notify_rect_changed(*this, oldRect, m_rect);
WSWindowManager::the().notify_rect_changed(*this, old_rect, m_rect);
}
// FIXME: Just use the same types.
@ -60,16 +60,19 @@ void WSWindow::event(WSEvent& event)
gui_event.type = GUI_Event::Type::MouseMove;
gui_event.mouse.position = static_cast<MouseEvent&>(event).position();
gui_event.mouse.button = GUI_MouseButton::NoButton;
gui_event.mouse.buttons = static_cast<MouseEvent&>(event).buttons();
break;
case WSEvent::MouseDown:
gui_event.type = GUI_Event::Type::MouseDown;
gui_event.mouse.position = static_cast<MouseEvent&>(event).position();
gui_event.mouse.button = to_api(static_cast<MouseEvent&>(event).button());
gui_event.mouse.buttons = static_cast<MouseEvent&>(event).buttons();
break;
case WSEvent::MouseUp:
gui_event.type = GUI_Event::Type::MouseUp;
gui_event.mouse.position = static_cast<MouseEvent&>(event).position();
gui_event.mouse.button = to_api(static_cast<MouseEvent&>(event).button());
gui_event.mouse.buttons = static_cast<MouseEvent&>(event).buttons();
break;
case WSEvent::KeyDown:
gui_event.type = GUI_Event::Type::KeyDown;