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
commit 45ed58865e
Notes: sideshowbarker 2024-07-19 03:16:35 +09:00
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;