mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
WindowServer: Always process double clicks for mouse events
This used to be optional and was disabled in two cases: - On a mouse move event during dragging; because double clicks are only possible on mouse up events, this had no effect. - On a mouse event for automatic cursor tracking; this has now gained support for double click events. Since it's always enabled now, we can remove the `bool` argument.
This commit is contained in:
parent
448b187782
commit
3e70d41c57
3 changed files with 10 additions and 11 deletions
|
@ -1020,7 +1020,7 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event)
|
|||
if (auto* window = hovered_window()) {
|
||||
event.set_drag(true);
|
||||
event.set_mime_data(*m_dnd_mime_data);
|
||||
deliver_mouse_event(*window, event, false);
|
||||
deliver_mouse_event(*window, event);
|
||||
} else {
|
||||
set_accepts_drag(false);
|
||||
}
|
||||
|
@ -1171,11 +1171,11 @@ void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& ev
|
|||
metadata.last_position = event.position();
|
||||
}
|
||||
|
||||
void WindowManager::deliver_mouse_event(Window& window, MouseEvent const& event, bool process_double_click)
|
||||
void WindowManager::deliver_mouse_event(Window& window, MouseEvent const& event)
|
||||
{
|
||||
auto translated_event = event.translated(-window.position());
|
||||
window.dispatch_event(translated_event);
|
||||
if (process_double_click && translated_event.type() == Event::MouseUp) {
|
||||
if (translated_event.type() == Event::MouseUp) {
|
||||
process_event_for_doubleclick(window, translated_event);
|
||||
if (translated_event.type() == Event::MouseDoubleClick)
|
||||
window.dispatch_event(translated_event);
|
||||
|
@ -1194,7 +1194,7 @@ bool WindowManager::process_ongoing_active_input_mouse_event(MouseEvent const& e
|
|||
//
|
||||
// This prevents e.g. moving on one window out of the bounds starting
|
||||
// a move in that other unrelated window, and other silly shenanigans.
|
||||
deliver_mouse_event(*input_tracking_window, event, true);
|
||||
deliver_mouse_event(*input_tracking_window, event);
|
||||
|
||||
if (event.type() == Event::MouseUp && event.buttons() == 0)
|
||||
set_automatic_cursor_tracking_window(nullptr);
|
||||
|
@ -1278,9 +1278,8 @@ void WindowManager::process_mouse_event_for_window(HitTestResult& result, MouseE
|
|||
return;
|
||||
}
|
||||
|
||||
if (!window.is_automatic_cursor_tracking()) {
|
||||
deliver_mouse_event(window, event, true);
|
||||
}
|
||||
if (!window.is_automatic_cursor_tracking())
|
||||
deliver_mouse_event(window, event);
|
||||
|
||||
if (event.type() == Event::MouseDown)
|
||||
set_automatic_cursor_tracking_window(&window);
|
||||
|
@ -1306,7 +1305,7 @@ void WindowManager::process_mouse_event(MouseEvent& event)
|
|||
// in the next step.
|
||||
for_each_visible_window_from_front_to_back([&](Window& window) {
|
||||
if (window.is_automatic_cursor_tracking() && &window != automatic_cursor_tracking_window())
|
||||
deliver_mouse_event(window, event, false);
|
||||
deliver_mouse_event(window, event);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue