mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-20 14:44:43 +00:00
Start bringing up LibGUI properly (formerly Widgets.)
This commit is contained in:
@@ -41,8 +41,13 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, bool left_button, bool righ
|
||||
m_cursor_location.set_x(width() - 1);
|
||||
if (m_cursor_location.y() >= height())
|
||||
m_cursor_location.set_y(height() - 1);
|
||||
unsigned buttons = 0;
|
||||
if (left_button)
|
||||
buttons |= (unsigned)MouseButton::Left;
|
||||
if (right_button)
|
||||
buttons |= (unsigned)MouseButton::Right;
|
||||
if (m_cursor_location != prev_location) {
|
||||
auto event = make<MouseEvent>(WSEvent::MouseMove, m_cursor_location.x(), m_cursor_location.y());
|
||||
auto event = make<MouseEvent>(WSEvent::MouseMove, m_cursor_location, buttons);
|
||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||
}
|
||||
bool prev_left_button = m_left_mouse_button_pressed;
|
||||
@@ -50,11 +55,11 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, bool left_button, bool righ
|
||||
m_left_mouse_button_pressed = left_button;
|
||||
m_right_mouse_button_pressed = right_button;
|
||||
if (prev_left_button != left_button) {
|
||||
auto event = make<MouseEvent>(left_button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location.x(), m_cursor_location.y(), MouseButton::Left);
|
||||
auto event = make<MouseEvent>(left_button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location, buttons, MouseButton::Left);
|
||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||
}
|
||||
if (prev_right_button != right_button) {
|
||||
auto event = make<MouseEvent>(right_button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location.x(), m_cursor_location.y(), MouseButton::Right);
|
||||
auto event = make<MouseEvent>(right_button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location, buttons, MouseButton::Right);
|
||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||
}
|
||||
if (m_cursor_location != prev_location || prev_left_button != left_button)
|
||||
|
||||
Reference in New Issue
Block a user