From 5396d90d16af3e8eeba88f4933841f3016a85f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 7 May 2010 11:29:41 +0000 Subject: [PATCH] * Made zooming to full screen center the window when the window cannot be made full screen (due to size restrictions). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36714 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index c99747b87e..964c2b564c 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1681,14 +1681,18 @@ BWindow::Zoom() BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth, tabHeight + borderWidth); + // Center if window cannot be made full screen + if (screenWidth > zoomedWidth) + zoomedLeftTop.x += (screenWidth - zoomedWidth) / 2; + if (screenHeight > zoomedHeight) + zoomedLeftTop.y += (screenHeight - zoomedHeight) / 2; // Un-Zoom if (fPreviousFrame.IsValid() // NOTE: don't check for fFrame.LeftTop() == zoomedLeftTop // -> makes it easier on the user to get a window back into place - && fFrame.Width() == zoomedWidth - && fFrame.Height() == zoomedHeight) { + && fFrame.Width() == zoomedWidth && fFrame.Height() == zoomedHeight) { // already zoomed! Zoom(fPreviousFrame.LeftTop(), fPreviousFrame.Width(), fPreviousFrame.Height());