From 48ae3e3808d235e6bea5efdf254eefaff892920d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 27 May 2011 22:21:59 +0000 Subject: [PATCH] * Followed Ingo's suggestion, and added a BWindow::Layout() method. * Changed ShowImage to use that function. +alpha in case Ingo gives his okay :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41782 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/Window.h | 5 ++++- src/apps/showimage/ShowImageWindow.cpp | 6 +++--- src/kits/interface/Window.cpp | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index 74809825c5..03a63e1828 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Copyright 2001-2011, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _WINDOW_H @@ -10,6 +10,7 @@ #include #include + class BButton; class BMenuBar; class BMenuItem; @@ -260,6 +261,7 @@ public: BLayout* GetLayout() const; void InvalidateLayout(bool descendants = false); + void Layout(bool force); private: // FBC padding and forbidden methods @@ -394,4 +396,5 @@ private: uint32 _reserved[9]; }; + #endif // _WINDOW_H diff --git a/src/apps/showimage/ShowImageWindow.cpp b/src/apps/showimage/ShowImageWindow.cpp index 906c55d2b1..39b14ff494 100644 --- a/src/apps/showimage/ShowImageWindow.cpp +++ b/src/apps/showimage/ShowImageWindow.cpp @@ -1295,9 +1295,9 @@ ShowImageWindow::_ToggleFullScreen() fImageView->SetHideIdlingCursor(fFullScreen); fImageView->SetShowCaption(fFullScreen && fShowCaption); - GetLayout()->Relayout(true); - // We need to manually relayout here, as the views would be relayouted - // later, and FitToBounds() would still have the wrong size + Layout(false); + // We need to manually relayout here, as the views are layouted + // asynchronously, and FitToBounds() would still have the wrong size fImageView->FitToBounds(); } diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index bf6272db7c..ad8db8133b 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Haiku. + * Copyright 2001-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -1445,11 +1445,7 @@ FrameMoved(origin); case B_LAYOUT_WINDOW: { - UpdateSizeLimits(); - - // do the actual layout - fTopView->Layout(false); - + Layout(false); break; } @@ -2632,6 +2628,16 @@ BWindow::InvalidateLayout(bool descendants) } +void +BWindow::Layout(bool force) +{ + UpdateSizeLimits(); + + // Do the actual layout + fTopView->Layout(force); +} + + status_t BWindow::GetSupportedSuites(BMessage* data) {