1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:35:07 +00:00

LibGUI: Widget updates should invalidate their window-relative rect.

This commit is contained in:
Andreas Kling 2019-02-09 14:30:05 +01:00
parent 6a3ff7efc5
commit 5bd363c4bb
2 changed files with 12 additions and 1 deletions

View file

@ -139,7 +139,16 @@ void GWidget::update()
if (m_has_pending_paint_event)
return;
m_has_pending_paint_event = true;
w->update(relative_rect());
w->update(window_relative_rect());
}
Rect GWidget::window_relative_rect() const
{
auto rect = relative_rect();
for (auto* parent = parent_widget(); parent; parent = parent->parent_widget()) {
rect.move_by(parent->relative_position());
}
return rect;
}
GWidget::HitTestResult GWidget::hit_test(int x, int y)