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

LibGUI: Only dispatch Leave if the now-hovered widget isn't a child

Without this change, when the mouse starts hovering over a child widget,
the parent would receive a Leave event despite the parent widget not
losing mouse hover.
This commit is contained in:
sin-ack 2021-07-25 21:09:54 +00:00 committed by Ali Mohammad Pur
parent 444ed56521
commit cfc9ee6f16
3 changed files with 19 additions and 1 deletions

View file

@ -1138,4 +1138,20 @@ 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;
}
}