diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-08-17 19:43:52 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-25 13:28:50 +0200 |
commit | a1dceb5b97480100e5f03aaee53ee3cbfa549c26 (patch) | |
tree | 7bb1f266eb52ac4be0c7a96bee227a98208310e4 /Userland/Services/WindowServer/Window.cpp | |
parent | b180132c878f7ec4fc768c422e7e171abf0cefb1 (diff) | |
download | serenity-a1dceb5b97480100e5f03aaee53ee3cbfa549c26.zip |
WindowServer: Remove nudge_into_desktop() from Window
Positioning windows outside visible coordinates is valid if sometimes
curious behavior, but it shouldn't be considered misbehavior by default.
There are multiple ways to recover windows with obscured title bars,
and this function papers over actual resize bugs and is no longer
needed to normalize window size, so let's remove it for now.
Diffstat (limited to 'Userland/Services/WindowServer/Window.cpp')
-rw-r--r-- | Userland/Services/WindowServer/Window.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index cabcfdface..43fc259806 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -190,52 +190,6 @@ bool Window::apply_minimum_size(Gfx::IntRect& rect) return did_size_clamp; } -void Window::nudge_into_desktop(Screen* target_screen, bool force_titlebar_visible) -{ - if (!target_screen) { - // If no explicit target screen was supplied, - // guess based on the current frame rectangle - target_screen = &Screen::closest_to_rect(rect()); - } - Gfx::IntRect arena = WindowManager::the().arena_rect_for_type(*target_screen, type()); - auto min_visible = 1; - switch (type()) { - case WindowType::Normal: - min_visible = 30; - break; - case WindowType::Desktop: - set_rect(arena); - return; - default: - break; - } - - // Push the frame around such that at least `min_visible` pixels of the *frame* are in the desktop rect. - auto old_frame_rect = frame().rect(); - Gfx::IntRect new_frame_rect = { - clamp(old_frame_rect.x(), arena.left() + min_visible - width(), arena.right() - min_visible), - clamp(old_frame_rect.y(), arena.top() + min_visible - height(), arena.bottom() - min_visible), - old_frame_rect.width(), - old_frame_rect.height(), - }; - - // Make sure that at least half of the titlebar is visible. - auto min_frame_y = arena.top() - (y() - old_frame_rect.y()) / 2; - if (force_titlebar_visible && new_frame_rect.y() < min_frame_y) { - new_frame_rect.set_y(min_frame_y); - } - - // Deduce new window rect: - Gfx::IntRect new_window_rect = { - x() + new_frame_rect.x() - old_frame_rect.x(), - y() + new_frame_rect.y() - old_frame_rect.y(), - width(), - height(), - }; - - set_rect(new_window_rect); -} - void Window::set_minimum_size(Gfx::IntSize const& size) { VERIFY(size.width() >= 0 && size.height() >= 0); |