[haiku-commits] r41782 - in haiku/trunk: headers/os/interface src/apps/showimage src/kits/interface

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 28 May 2011 00:22:00 +0200 (CEST)

Author: axeld
Date: 2011-05-28 00:21:59 +0200 (Sat, 28 May 2011)
New Revision: 41782
Changeset: https://dev.haiku-os.org/changeset/41782

Modified:
   haiku/trunk/headers/os/interface/Window.h
   haiku/trunk/src/apps/showimage/ShowImageWindow.cpp
   haiku/trunk/src/kits/interface/Window.cpp
Log:
* Followed Ingo's suggestion, and added a BWindow::Layout() method.
* Changed ShowImage to use that function.
+alpha in case Ingo gives his okay :-)


Modified: haiku/trunk/headers/os/interface/Window.h
===================================================================
--- haiku/trunk/headers/os/interface/Window.h   2011-05-27 21:51:39 UTC (rev 
41781)
+++ haiku/trunk/headers/os/interface/Window.h   2011-05-27 22:21:59 UTC (rev 
41782)
@@ -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 <StorageDefs.h>
 #include <View.h>
 
+
 class BButton;
 class BMenuBar;
 class BMenuItem;
@@ -260,6 +261,7 @@
                        BLayout*                        GetLayout() const;
 
                        void                            InvalidateLayout(bool 
descendants = false);
+                       void                            Layout(bool force);
 
 private:
        // FBC padding and forbidden methods
@@ -394,4 +396,5 @@
                        uint32                          _reserved[9];
 };
 
+
 #endif // _WINDOW_H

Modified: haiku/trunk/src/apps/showimage/ShowImageWindow.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ShowImageWindow.cpp  2011-05-27 21:51:39 UTC 
(rev 41781)
+++ haiku/trunk/src/apps/showimage/ShowImageWindow.cpp  2011-05-27 22:21:59 UTC 
(rev 41782)
@@ -1295,9 +1295,9 @@
        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();
 }
 

Modified: haiku/trunk/src/kits/interface/Window.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Window.cpp   2011-05-27 21:51:39 UTC (rev 
41781)
+++ haiku/trunk/src/kits/interface/Window.cpp   2011-05-27 22:21:59 UTC (rev 
41782)
@@ -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 @@
 
                case B_LAYOUT_WINDOW:
                {
-                       UpdateSizeLimits();
-
-                       // do the actual layout
-                       fTopView->Layout(false);
-
+                       Layout(false);
                        break;
                }
 
@@ -2632,6 +2628,16 @@
 }
 
 
+void
+BWindow::Layout(bool force)
+{
+       UpdateSizeLimits();
+
+       // Do the actual layout
+       fTopView->Layout(force);
+}
+
+
 status_t
 BWindow::GetSupportedSuites(BMessage* data)
 {


Other related posts: