1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibGUI+WindowServer: Provide default placement to windows

This prevents windows from being opened directly on top of eachother,
and provides default behavior for when window position is not specified.

The new behavior is as follows:
- Windows that have been created without a set position are assigned one
  by WindowServer.
- The assigned position is either offset from the last window that is
  still in an assigned position, or a default position if no such window
  is available.
This commit is contained in:
Peter Elliott 2020-07-30 19:52:45 -06:00 committed by Andreas Kling
parent 586ada7a14
commit 5ae9eee4a3
8 changed files with 62 additions and 4 deletions

View file

@ -273,6 +273,7 @@ void Window::set_maximized(bool maximized)
}
m_frame.did_set_maximized({}, maximized);
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(old_rect, m_rect));
set_default_positioned(false);
}
void Window::set_resizable(bool resizable)
@ -398,7 +399,7 @@ Window* Window::is_blocked_by_modal_window()
if (window && !window->is_destroyed()) {
if (window->is_modal())
return window;
if (auto* blocking_modal_window = window->is_blocked_by_modal_window())
return blocking_modal_window;
}
@ -601,7 +602,7 @@ bool Window::is_accessory() const
return false;
if (parent_window() != nullptr)
return true;
// If accessory window was unparented, convert to a regular window
const_cast<Window*>(this)->set_accessory(false);
return false;