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

LibGUI: Add GWidget::doubleclick_event().

Now double-clicking an item in a GTableView or GItemView will activate it.
This commit is contained in:
Andreas Kling 2019-03-25 01:42:15 +01:00
parent 43f9027968
commit 20f7d7ec67
11 changed files with 100 additions and 7 deletions

View file

@ -798,12 +798,15 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_
if (process_ongoing_window_resize(event, event_window))
return;
HashTable<WSWindow*> windows_who_received_mouse_event_due_to_cursor_tracking;
for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) {
if (!window->global_cursor_tracking())
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(), event.modifiers());
windows_who_received_mouse_event_due_to_cursor_tracking.set(window);
window->on_message(*local_event);
}
@ -849,7 +852,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_
if (window.type() == WSWindowType::Normal && event.type() == WSMessage::MouseDown)
move_to_front_and_make_active(window);
event_window = &window;
if (!window.global_cursor_tracking()) {
if (!window.global_cursor_tracking() && !windows_who_received_mouse_event_due_to_cursor_tracking.contains(&window)) {
// 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(), event.modifiers());