From 1ac98e3ab4767b80ed09b61418468888bac8bac6 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 21 Dec 2018 12:37:10 -0500 Subject: [PATCH] BWindow: Prevent CenterIn from moving the decorator bar offscreen. The MoveTo() call is not restricted in any way; it can easily move the window's titlebar offscreen, which is very confusing for users as if they don't remember the window manipulation keyboard shortcuts, dealing with such windows is often very tricky (or impossible if the window is actually larger than the screen.) Now we also call MoveOnScreen with DO_NOT_RESIZE and MOVE_IF_PARTIALLY_OFFSCREEN set, which will simply get the size of the decorator bar and then ensure it is entirely on-screen. Fixes #11763. --- src/kits/interface/Window.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 89afdff9b7..2ca09cf4ae 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2619,6 +2619,7 @@ BWindow::CenterIn(const BRect& rect) MoveTo(BLayoutUtils::AlignInFrame(rect, Size(), BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER)).LeftTop()); + MoveOnScreen(B_DO_NOT_RESIZE_TO_FIT | B_MOVE_IF_PARTIALLY_OFFSCREEN); }