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

Userland: Use Rect::centered_within() where useful

This commit is contained in:
Andreas Kling 2021-08-30 22:18:20 +02:00
parent 43220568b0
commit 087bd7f767
9 changed files with 15 additions and 34 deletions

View file

@ -286,18 +286,14 @@ void Window::set_minimum_size(const Gfx::IntSize& size)
void Window::center_on_screen()
{
auto window_rect = rect();
window_rect.center_within(Desktop::the().rect());
set_rect(window_rect);
set_rect(rect().centered_within(Desktop::the().rect()));
}
void Window::center_within(const Window& other)
{
if (this == &other)
return;
auto window_rect = rect();
window_rect.center_within(other.rect());
set_rect(window_rect);
set_rect(rect().centered_within(other.rect()));
}
void Window::set_window_type(WindowType window_type)