1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-23 09:52:10 +00:00

WindowServer: Make tiled windows actually centered.

The right window had a few pixels on the right cut off, i don't know how
i didn't notice this earlier.
This commit is contained in:
Chyza 2020-01-02 19:03:51 +00:00 committed by Andreas Kling
parent fe67ba032d
commit 51a9e31fb2

View file

@ -301,7 +301,7 @@ void WSWindow::set_tiled(WindowTileType tiled)
m_tiled = tiled; m_tiled = tiled;
auto old_rect = m_rect; auto old_rect = m_rect;
auto frame_width = m_frame.rect().width() - m_rect.width(); int frame_width = (m_frame.rect().width() - m_rect.width()) / 2;
switch (tiled) { switch (tiled) {
case WindowTileType::None : case WindowTileType::None :
set_rect(m_untiled_rect); set_rect(m_untiled_rect);
@ -310,14 +310,14 @@ void WSWindow::set_tiled(WindowTileType tiled)
m_untiled_rect = m_rect; m_untiled_rect = m_rect;
set_rect(0, set_rect(0,
WSWindowManager::the().maximized_window_rect(*this).y(), WSWindowManager::the().maximized_window_rect(*this).y(),
WSScreen::the().width() / 2, WSScreen::the().width() / 2 - frame_width,
WSWindowManager::the().maximized_window_rect(*this).height()); WSWindowManager::the().maximized_window_rect(*this).height());
break; break;
case WindowTileType::Right : case WindowTileType::Right :
m_untiled_rect = m_rect; m_untiled_rect = m_rect;
set_rect(WSScreen::the().width() / 2 + frame_width, set_rect(WSScreen::the().width() / 2 + frame_width,
WSWindowManager::the().maximized_window_rect(*this).y(), WSWindowManager::the().maximized_window_rect(*this).y(),
(WSScreen::the().width() / 2), (WSScreen::the().width() / 2) - frame_width,
WSWindowManager::the().maximized_window_rect(*this).height()); WSWindowManager::the().maximized_window_rect(*this).height());
break; break;
} }