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

LibGUI+WindowServer: Add resize_aspect_ratio()

When a resize_aspect_ratio is specified, and window will only be resized
to a multiple of that ratio. When resize_aspect_ratio is set, windows
cannot be tiled.
This commit is contained in:
Peter Elliott 2020-08-21 14:19:10 -06:00 committed by Andreas Kling
parent c68537271c
commit 45ed58865e
8 changed files with 51 additions and 1 deletions

View file

@ -297,7 +297,7 @@ void Window::set_maximized(bool maximized)
{
if (m_maximized == maximized)
return;
if (maximized && !is_resizable())
if (maximized && (!is_resizable() || resize_aspect_ratio().has_value()))
return;
set_tiled(WindowTileType::None);
m_maximized = maximized;
@ -616,6 +616,9 @@ void Window::set_tiled(WindowTileType tiled)
if (m_tiled == tiled)
return;
if (resize_aspect_ratio().has_value())
return;
m_tiled = tiled;
if (tiled != WindowTileType::None)
m_untiled_rect = m_rect;