mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
LibGUI: Widget updates should invalidate their window-relative rect.
This commit is contained in:
parent
6a3ff7efc5
commit
5bd363c4bb
2 changed files with 12 additions and 1 deletions
|
@ -139,7 +139,16 @@ void GWidget::update()
|
||||||
if (m_has_pending_paint_event)
|
if (m_has_pending_paint_event)
|
||||||
return;
|
return;
|
||||||
m_has_pending_paint_event = true;
|
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)
|
GWidget::HitTestResult GWidget::hit_test(int x, int y)
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
Rect relative_rect() const { return m_relative_rect; }
|
Rect relative_rect() const { return m_relative_rect; }
|
||||||
Point relative_position() const { return m_relative_rect.location(); }
|
Point relative_position() const { return m_relative_rect.location(); }
|
||||||
|
|
||||||
|
Rect window_relative_rect() const;
|
||||||
|
|
||||||
int x() const { return m_relative_rect.x(); }
|
int x() const { return m_relative_rect.x(); }
|
||||||
int y() const { return m_relative_rect.y(); }
|
int y() const { return m_relative_rect.y(); }
|
||||||
int width() const { return m_relative_rect.width(); }
|
int width() const { return m_relative_rect.width(); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue