diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-01 23:00:42 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-02 01:29:55 +0200 |
commit | c6899b091023bd8acfac482f98c8cea89d740758 (patch) | |
tree | 9c590c2c75701ddd1372ba44b12c0cd169e10f44 /Servers/WindowServer/Window.h | |
parent | 6228f72b87a87e6ce50bef75eb1bb947acff6e10 (diff) | |
download | serenity-c6899b091023bd8acfac482f98c8cea89d740758.zip |
WindowServer: Move child windows together with their parents
When moving a window, we will now move any child windows by the same
position delta as the parent. This makes ComboBox popup list windows
follow the window they were opened by, which looks nice. :^)
Diffstat (limited to 'Servers/WindowServer/Window.h')
-rw-r--r-- | Servers/WindowServer/Window.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Servers/WindowServer/Window.h b/Servers/WindowServer/Window.h index 71e8d6bfc0..5705d09114 100644 --- a/Servers/WindowServer/Window.h +++ b/Servers/WindowServer/Window.h @@ -142,15 +142,7 @@ public: Gfx::Rect rect() const { return m_rect; } void set_rect(const Gfx::Rect&); void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); } - void set_rect_without_repaint(const Gfx::Rect& rect) - { - ASSERT(!rect.is_empty()); - if (m_rect == rect) - return; - auto old_rect = m_rect; - m_rect = rect; - m_frame.notify_window_rect_changed(old_rect, rect); - } + void set_rect_without_repaint(const Gfx::Rect&); void set_taskbar_rect(const Gfx::Rect& rect) { m_taskbar_rect = rect; } const Gfx::Rect& taskbar_rect() const { return m_taskbar_rect; } @@ -158,6 +150,8 @@ public: void move_to(const Gfx::Point& position) { set_rect({ position, size() }); } void move_to(int x, int y) { move_to({ x, y }); } + void move_by(const Gfx::Point& delta) { set_position_without_repaint(position().translated(delta)); } + Gfx::Point position() const { return m_rect.location(); } void set_position(const Gfx::Point& position) { set_rect({ position.x(), position.y(), width(), height() }); } void set_position_without_repaint(const Gfx::Point& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); } |