mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibGUI+WindowServer: Remove now-obsolete cursor tracking feature
This feature was problematic for several reasons: - Tracking *all* the user activity seems like a privacy nightmare. - LibGUI actually only supports one globally tracking widget per window, even if no window is necessary, or if multiple callbacks are desired. - Widgets can easily get confused whether an event is actually directed at it, or is actually just the result of global tracking. The third item caused an issue where right-clicking CatDog opened two context menus instead of one.
This commit is contained in:
parent
0a69da08aa
commit
c6e56612f5
8 changed files with 1 additions and 60 deletions
|
@ -347,13 +347,6 @@ void Window::handle_drop_event(DropEvent& event)
|
|||
|
||||
void Window::handle_mouse_event(MouseEvent& event)
|
||||
{
|
||||
if (m_global_cursor_tracking_widget) {
|
||||
auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect();
|
||||
Gfx::IntPoint local_point { event.x() - window_relative_rect.x(), event.y() - window_relative_rect.y() };
|
||||
auto local_event = MouseEvent((Event::Type)event.type(), local_point, event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
|
||||
m_global_cursor_tracking_widget->dispatch_event(local_event, this);
|
||||
return;
|
||||
}
|
||||
if (m_automatic_cursor_tracking_widget) {
|
||||
auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect();
|
||||
Gfx::IntPoint local_point { event.x() - window_relative_rect.x(), event.y() - window_relative_rect.y() };
|
||||
|
@ -371,8 +364,7 @@ void Window::handle_mouse_event(MouseEvent& event)
|
|||
set_hovered_widget(result.widget);
|
||||
if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget)
|
||||
m_automatic_cursor_tracking_widget = *result.widget;
|
||||
if (result.widget != m_global_cursor_tracking_widget.ptr())
|
||||
result.widget->dispatch_event(local_event, this);
|
||||
result.widget->dispatch_event(local_event, this);
|
||||
|
||||
if (!m_pending_paint_event_rects.is_empty()) {
|
||||
MultiPaintEvent paint_event(move(m_pending_paint_event_rects), size());
|
||||
|
@ -755,13 +747,6 @@ void Window::set_focused_widget(Widget* widget, FocusSource source)
|
|||
}
|
||||
}
|
||||
|
||||
void Window::set_global_cursor_tracking_widget(Widget* widget)
|
||||
{
|
||||
if (widget == m_global_cursor_tracking_widget)
|
||||
return;
|
||||
m_global_cursor_tracking_widget = widget;
|
||||
}
|
||||
|
||||
void Window::set_automatic_cursor_tracking_widget(Widget* widget)
|
||||
{
|
||||
if (widget == m_automatic_cursor_tracking_widget)
|
||||
|
@ -1138,8 +1123,6 @@ void Window::did_remove_widget(Badge<Widget>, Widget& widget)
|
|||
m_focused_widget = nullptr;
|
||||
if (m_hovered_widget == &widget)
|
||||
m_hovered_widget = nullptr;
|
||||
if (m_global_cursor_tracking_widget == &widget)
|
||||
m_global_cursor_tracking_widget = nullptr;
|
||||
if (m_automatic_cursor_tracking_widget == &widget)
|
||||
m_automatic_cursor_tracking_widget = nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue