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

WindowManager: Restore a window's geometry when untiling it

Specifically, when untiling it using the Super-{Left,Right} shortcuts

Fixes #5182
This commit is contained in:
etaIneLp 2021-01-30 13:57:27 -05:00 committed by Andreas Kling
parent c0e88b9710
commit e625ae1130
3 changed files with 15 additions and 7 deletions

View file

@ -702,7 +702,7 @@ Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const
}
}
bool Window::set_untiled(const Gfx::IntPoint& fixed_point)
bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point)
{
if (m_tiled == WindowTileType::None)
return false;
@ -710,9 +710,13 @@ bool Window::set_untiled(const Gfx::IntPoint& fixed_point)
m_tiled = WindowTileType::None;
auto new_rect = Gfx::IntRect(m_rect);
new_rect.set_size_around(m_untiled_rect.size(), fixed_point);
set_rect(new_rect);
if (fixed_point.has_value()) {
auto new_rect = Gfx::IntRect(m_rect);
new_rect.set_size_around(m_untiled_rect.size(), fixed_point.value());
set_rect(new_rect);
} else {
set_rect(m_untiled_rect);
}
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(m_rect));