1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 13:55:07 +00:00

LibGUI+WindowServer: Implement drag-to-select behavior in GTextEditor.

To make this feel right, I needed to start passing keyboard modifiers along
with mouse events. That allows shift-clicking to extend the selection. :^)
This commit is contained in:
Andreas Kling 2019-03-08 17:53:02 +01:00
parent 6d172725c0
commit f40d11f06d
11 changed files with 73 additions and 21 deletions

View file

@ -762,7 +762,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_
continue;
ASSERT(window->is_visible()); // Maybe this should be supported? Idk. Let's catch it and think about it later.
Point position { event.x() - window->rect().x(), event.y() - window->rect().y() };
auto local_event = make<WSMouseEvent>(event.type(), position, event.buttons(), event.button());
auto local_event = make<WSMouseEvent>(event.type(), position, event.buttons(), event.button(), event.modifiers());
window->on_message(*local_event);
}
@ -815,7 +815,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_
if (!window.global_cursor_tracking()) {
// FIXME: Should we just alter the coordinates of the existing MouseEvent and pass it through?
Point position { event.x() - window.rect().x(), event.y() - window.rect().y() };
auto local_event = make<WSMouseEvent>(event.type(), position, event.buttons(), event.button());
auto local_event = make<WSMouseEvent>(event.type(), position, event.buttons(), event.button(), event.modifiers());
window.on_message(*local_event);
}
return IterationDecision::Abort;