mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Revert "LibGUI: Only dispatch Leave if the now-hovered widget isn't a child"
This reverts commit cfc9ee6f16
.
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.
This commit is contained in:
parent
230f7ce71c
commit
2135c66823
3 changed files with 1 additions and 19 deletions
|
@ -1143,20 +1143,4 @@ bool Widget::is_visible_for_timer_purposes() const
|
||||||
return is_visible() && Object::is_visible_for_timer_purposes();
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,8 +280,6 @@ public:
|
||||||
|
|
||||||
bool has_pending_drop() const;
|
bool has_pending_drop() const;
|
||||||
|
|
||||||
bool is_parent_of(Widget const*) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Widget();
|
Widget();
|
||||||
|
|
||||||
|
|
|
@ -802,7 +802,7 @@ void Window::set_hovered_widget(Widget* widget)
|
||||||
if (widget == m_hovered_widget)
|
if (widget == m_hovered_widget)
|
||||||
return;
|
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));
|
Core::EventLoop::current().post_event(*m_hovered_widget, make<Event>(Event::Leave));
|
||||||
|
|
||||||
m_hovered_widget = widget;
|
m_hovered_widget = widget;
|
||||||
|
|
Loading…
Add table
Reference in a new issue