mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
WindowServer: Port WindowServer to LibCore.
This was pretty straightforward thanks to the work I did separating out LibCore from LibGUI already. :^) - WSMessageLoop now inherits from CEventLoop. - WSMessage now inherits from CEvent. - WSMessageReceiver goes away. Now there is only one event loop in Serenity. Very nice!
This commit is contained in:
parent
4132f645ee
commit
de184d0999
20 changed files with 170 additions and 320 deletions
|
@ -70,14 +70,14 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, unsigned buttons)
|
|||
if (!(changed_buttons & (unsigned)button))
|
||||
return;
|
||||
auto message = make<WSMouseEvent>(buttons & (unsigned)button ? WSMessage::MouseDown : WSMessage::MouseUp, m_cursor_location, buttons, button, m_modifiers);
|
||||
WSMessageLoop::the().post_message(WSWindowManager::the(), move(message));
|
||||
WSMessageLoop::the().post_event(WSWindowManager::the(), move(message));
|
||||
};
|
||||
post_mousedown_or_mouseup_if_needed(MouseButton::Left);
|
||||
post_mousedown_or_mouseup_if_needed(MouseButton::Right);
|
||||
post_mousedown_or_mouseup_if_needed(MouseButton::Middle);
|
||||
if (m_cursor_location != prev_location) {
|
||||
auto message = make<WSMouseEvent>(WSMessage::MouseMove, m_cursor_location, buttons, MouseButton::None, m_modifiers);
|
||||
WSMessageLoop::the().post_message(WSWindowManager::the(), move(message));
|
||||
WSMessageLoop::the().post_event(WSWindowManager::the(), move(message));
|
||||
}
|
||||
// NOTE: Invalidate the cursor if it moved, or if the left button changed state (for the cursor color inversion.)
|
||||
if (m_cursor_location != prev_location || changed_buttons & (unsigned)MouseButton::Left)
|
||||
|
@ -88,7 +88,7 @@ void WSScreen::on_receive_keyboard_data(KeyEvent kernel_event)
|
|||
{
|
||||
m_modifiers = kernel_event.modifiers();
|
||||
auto message = make<WSKeyEvent>(kernel_event.is_press() ? WSMessage::KeyDown : WSMessage::KeyUp, kernel_event.key, kernel_event.character, kernel_event.modifiers());
|
||||
WSMessageLoop::the().post_message(WSWindowManager::the(), move(message));
|
||||
WSMessageLoop::the().post_event(WSWindowManager::the(), move(message));
|
||||
}
|
||||
|
||||
void WSScreen::set_y_offset(int offset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue