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

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. :^)
This commit is contained in:
Andreas Kling 2020-05-01 23:00:42 +02:00
parent 6228f72b87
commit c6899b0910
2 changed files with 22 additions and 9 deletions

View file

@ -142,6 +142,25 @@ void Window::set_rect(const Gfx::Rect& rect)
m_frame.notify_window_rect_changed(old_rect, rect);
}
void Window::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;
if (old_rect.size() == m_rect.size()) {
auto delta = m_rect.location() - old_rect.location();
for (auto& child_window : m_child_windows) {
if (child_window)
child_window->move_by(delta);
}
}
m_frame.notify_window_rect_changed(old_rect, rect);
}
void Window::handle_mouse_event(const MouseEvent& event)
{
set_automatic_cursor_tracking_enabled(event.buttons() != 0);