1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

WindowServer: Unify Window restore rects

Previously, different rects were used to restore tiled and maximized
windows, creating edge cases for inconsistent restoration. All states
now restore m_floating_rect, which saves the last valid size and
location of a window while free-floating.
This commit is contained in:
thankyouverycool 2022-02-07 13:22:02 -05:00 committed by Andreas Kling
parent 3d7e701451
commit 1607fd511f
3 changed files with 19 additions and 6 deletions

View file

@ -740,6 +740,9 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event)
dbgln_if(MOVE_DEBUG, "[WM] Finish moving Window({})", m_move_window);
if (!m_move_window->is_tiled() && !m_move_window->is_maximized())
m_move_window->set_floating_rect(m_move_window->rect());
m_move_window->invalidate(true, true);
if (m_move_window->is_resizable()) {
process_event_for_doubleclick(*m_move_window, event);
@ -824,6 +827,9 @@ bool WindowManager::process_ongoing_window_resize(MouseEvent const& event)
if (event.type() == Event::MouseUp && event.button() == m_resizing_mouse_button) {
dbgln_if(RESIZE_DEBUG, "[WM] Finish resizing Window({})", m_resize_window);
if (!m_resize_window->is_tiled() && !m_resize_window->is_maximized())
m_resize_window->set_floating_rect(m_resize_window->rect());
const int vertical_maximize_deadzone = 5;
auto& cursor_screen = ScreenInput::the().cursor_location_screen();
if (&cursor_screen == &Screen::closest_to_rect(m_resize_window->rect())) {