[haiku-commits] r38515 - haiku/trunk/src/add-ons/decorators/SATDecorator

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 3 Sep 2010 01:58:26 +0200 (CEST)

Author: czeidler
Date: 2010-09-03 01:58:26 +0200 (Fri, 03 Sep 2010)
New Revision: 38515
Changeset: http://dev.haiku-os.org/changeset/38515

Modified:
   haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp
   haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h
   haiku/trunk/src/add-ons/decorators/SATDecorator/StackAndTile.cpp
Log:
Clean up.



Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp       
2010-09-02 23:07:26 UTC (rev 38514)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.cpp       
2010-09-02 23:58:26 UTC (rev 38515)
@@ -51,6 +51,9 @@
 }
 
 
+const uint32 kExtentPenalty = 10;
+
+
 void
 GroupCookie::DoGroupLayout(SATWindow* triggerWindow)
 {
@@ -89,12 +92,13 @@
                        break;
                }
        }
+       _UpdateWindowSize(frame);
 
        // set penalties back to normal
-       fWidthConstraint->SetPenaltyNeg(10);
-       fWidthConstraint->SetPenaltyPos(10);
-       fHeightConstraint->SetPenaltyNeg(10);
-       fHeightConstraint->SetPenaltyPos(10);
+       fWidthConstraint->SetPenaltyNeg(kExtentPenalty);
+       fWidthConstraint->SetPenaltyPos(kExtentPenalty);
+       fHeightConstraint->SetPenaltyNeg(kExtentPenalty);
+       fHeightConstraint->SetPenaltyPos(kExtentPenalty);
 
        fLeftConstraint->SetPenaltyNeg(1);
        fLeftConstraint->SetPenaltyPos(1);
@@ -118,17 +122,8 @@
                fTopBorder->Value() - frame.top);
        desktop->ResizeWindowBy(window, fRightBorder->Value() - frame.right,
                fBottomBorder->Value() - frame.bottom);
-}
 
-
-void
-GroupCookie::UpdateWindowSize()
-{
-       BRect frame = fSATWindow->CompleteWindowFrame();
-
-       // adjust window size soft constraints
-       fWidthConstraint->SetRightSide(frame.Width());
-       fHeightConstraint->SetRightSide(frame.Height());
+       _UpdateWindowSize(frame);
 }
 
 
@@ -167,15 +162,17 @@
                fRightBorder, OperatorType(LE), -minWidth);
        fMinHeightConstraint = linearSpec->AddConstraint(1.0, fTopBorder, -1.0,
                fBottomBorder, OperatorType(LE), -minHeight);
-
+       
        // The width and height constraints have higher penalties than the
        // position constraints (left, top), so a window will keep its size
        // unless explicitly resized.
        fWidthConstraint = linearSpec->AddConstraint(-1.0, fLeftBorder, 1.0,
-               fRightBorder, OperatorType(EQ), frame.Width(), 10, 10);
+               fRightBorder, OperatorType(EQ), frame.Width(), kExtentPenalty,
+               kExtentPenalty);
        fHeightConstraint = linearSpec->AddConstraint(-1.0, fTopBorder, 1.0,
-               fBottomBorder, OperatorType(EQ), frame.Height(), 10, 10);
-       
+               fBottomBorder, OperatorType(EQ), frame.Height(), kExtentPenalty,
+               kExtentPenalty);
+
        if (!fLeftConstraint || !fTopConstraint || !fMinWidthConstraint
                || !fMinHeightConstraint || !fWidthConstraint || 
!fHeightConstraint) {
                // clean up
@@ -256,6 +253,15 @@
 }
 
 
+void
+GroupCookie::_UpdateWindowSize(const BRect& frame)
+{
+       // adjust window size soft constraints
+       fWidthConstraint->SetRightSide(frame.Width());
+       fHeightConstraint->SetRightSide(frame.Height());
+}
+
+
 SATWindow::SATWindow(StackAndTile* sat, Window* window)
        :
        fWindow(window),
@@ -328,29 +334,6 @@
 
 
 void
-SATWindow::UpdateGroupWindowsSize()
-{
-       SATGroup* group = GetGroup();
-       if (!group)
-               return;
-
-       for (int i = 0; i < group->CountItems(); i++) {
-               SATWindow* window = group->WindowAt(i);
-               if (window == this)
-                       continue;
-               window->UpdateWindowSize();
-       }
-}
-
-
-void
-SATWindow::UpdateWindowSize()
-{
-       fGroupCookie->UpdateWindowSize();
-}
-
-
-void
 SATWindow::MoveWindowToSAT(int32 workspace)
 {
        fGroupCookie->MoveWindow(workspace);

Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h 2010-09-02 
23:07:26 UTC (rev 38514)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/SATWindow.h 2010-09-02 
23:58:26 UTC (rev 38515)
@@ -32,7 +32,6 @@
 
                void                            DoGroupLayout(SATWindow* 
triggerWindow);
                void                            MoveWindow(int32 workspace);
-               void                            UpdateWindowSize();
 
                SATGroup*                       GetGroup() { return 
fSATGroup.Get(); }
 
@@ -41,6 +40,8 @@
                bool                            PropagateToGroup(SATGroup* 
group, WindowArea* area);
 
 private:
+               void                            _UpdateWindowSize(const BRect& 
frame);
+
                SATWindow*                      fSATWindow;
 
                BReference<SATGroup>    fSATGroup;
@@ -85,9 +86,6 @@
 
                bool                            PropagateToGroup(SATGroup* 
group, WindowArea* area);
 
-               void                            UpdateGroupWindowsSize();
-               void                            UpdateWindowSize();
-
                //! Move the window to the tab's position. 
                void                            MoveWindowToSAT(int32 
workspace);
 

Modified: haiku/trunk/src/add-ons/decorators/SATDecorator/StackAndTile.cpp
===================================================================
--- haiku/trunk/src/add-ons/decorators/SATDecorator/StackAndTile.cpp    
2010-09-02 23:07:26 UTC (rev 38514)
+++ haiku/trunk/src/add-ons/decorators/SATDecorator/StackAndTile.cpp    
2010-09-02 23:58:26 UTC (rev 38515)
@@ -182,9 +182,6 @@
                satWindow->FindSnappingCandidates();
        else {
                satWindow->DoGroupLayout();
-               // after solve the layout update the size constraints of all 
windows in
-               // the group
-               satWindow->UpdateGroupWindowsSize();
 
                // Do a window layout for all windows. TODO: mybe do it a bit 
more
                // efficient


Other related posts:

  • » [haiku-commits] r38515 - haiku/trunk/src/add-ons/decorators/SATDecorator - clemens . zeidler