diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-28 21:24:29 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-28 21:28:56 +0200 |
commit | 2135c66823553899a2927d319ac837ca2d43f0ab (patch) | |
tree | f1df56d901a85d8d201b024f8691dde267abf3a7 /Userland/Libraries/LibGUI | |
parent | 230f7ce71c3c07b5ebce8120c99c6d0c2069f12a (diff) | |
download | serenity-2135c66823553899a2927d319ac837ca2d43f0ab.zip |
Revert "LibGUI: Only dispatch Leave if the now-hovered widget isn't a child"
This reverts commit cfc9ee6f16b9c4d2b246bb2832dd436637cbeaad.
This change was wrong: The parent *does* lose hover when the mouse
cursor enters a child widget. Hover is not hierarchical, there is only a
hovered window and a hovered widget within that window.
This fixes an issue with GUI::TabWidget buttons appearing hovered
despite the mouse cursor not being over the buttons.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 2 |
3 files changed, 1 insertions, 19 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 9eca9eaa03..aa5689297d 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -1143,20 +1143,4 @@ bool Widget::is_visible_for_timer_purposes() const return is_visible() && Object::is_visible_for_timer_purposes(); } -bool Widget::is_parent_of(Widget const* widget) const -{ - if (widget == nullptr) - return false; - - Widget const* current_widget = widget->parent_widget(); - - while (current_widget != nullptr) { - if (current_widget == this) - return true; - current_widget = current_widget->parent_widget(); - } - - return false; -} - } diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index 4a5f4ef8f4..a46a735e89 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -280,8 +280,6 @@ public: bool has_pending_drop() const; - bool is_parent_of(Widget const*) const; - protected: Widget(); diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index aa00e8b684..f7a6a26d9d 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -802,7 +802,7 @@ void Window::set_hovered_widget(Widget* widget) if (widget == m_hovered_widget) return; - if (m_hovered_widget && !m_hovered_widget->is_parent_of(widget)) + if (m_hovered_widget) Core::EventLoop::current().post_event(*m_hovered_widget, make<Event>(Event::Leave)); m_hovered_widget = widget; |