diff --git a/LibGUI/GWidget.cpp b/LibGUI/GWidget.cpp index 76f94d8085..8dca7e125b 100644 --- a/LibGUI/GWidget.cpp +++ b/LibGUI/GWidget.cpp @@ -43,6 +43,9 @@ void GWidget::set_relative_rect(const Rect& rect) { if (rect == m_relative_rect) return; + + auto old_rect = m_relative_rect; + bool size_changed = m_relative_rect.size() != rect.size(); m_relative_rect = rect; @@ -51,6 +54,8 @@ void GWidget::set_relative_rect(const Rect& rect) event(resize_event); } + if (auto* parent = parent_widget()) + parent->update(old_rect); update(); } diff --git a/LibGUI/GWidget.h b/LibGUI/GWidget.h index 5c34380c35..5fc98de9f5 100644 --- a/LibGUI/GWidget.h +++ b/LibGUI/GWidget.h @@ -112,6 +112,9 @@ public: void resize(const Size& size) { set_relative_rect({ relative_rect().location(), size }); } void resize(int width, int height) { resize({ width, height }); } + void move_by(int x, int y) { move_by({ x, y }); } + void move_by(const Point& delta) { set_relative_rect({ relative_position().translated(delta), size() }); } + Color background_color() const { return m_background_color; } Color foreground_color() const { return m_foreground_color; }