[haiku-commits] haiku: hrev44596 - src/servers/app/stackandtile

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 1 Sep 2012 05:01:39 +0200 (CEST)

hrev44596 adds 2 changesets to branch 'master'
old head: e652fc18b67e03254f35ec2f1bb30b4a6fbe7b58
new head: 7dd16a4c95aa5f0ef5ad9dbc2abf652cf6105619

----------------------------------------------------------------------------

83092a0: Fix hrev42632.
  
  This really implements WindowSentBehind.

7dd16a4: Fix crash when splitting a S&T group.
  
  - Hold a ref to the old crossings till we cleaned up.
  - Additionally use a safer method to delete constraints.
  - Clean up.

                                     [ czeidler <haiku@xxxxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 36 insertions(+), 13 deletions(-)
src/servers/app/stackandtile/SATGroup.cpp     |   27 +++++++++++++--------
src/servers/app/stackandtile/SATGroup.h       |    4 +--
src/servers/app/stackandtile/StackAndTile.cpp |   18 ++++++++++++++

############################################################################

Commit:      83092a04a4ada9f91e8b45194da7de2c6183752a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=83092a0
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Sat Sep  1 02:51:10 2012 UTC

Fix hrev42632.

This really implements WindowSentBehind.

----------------------------------------------------------------------------

diff --git a/src/servers/app/stackandtile/StackAndTile.cpp 
b/src/servers/app/stackandtile/StackAndTile.cpp
index ec27493..2fb5454 100644
--- a/src/servers/app/stackandtile/StackAndTile.cpp
+++ b/src/servers/app/stackandtile/StackAndTile.cpp
@@ -308,6 +308,24 @@ StackAndTile::WindowActitvated(Window* window)
 void
 StackAndTile::WindowSentBehind(Window* window, Window* behindOf)
 {
+       SATWindow* satWindow = GetSATWindow(window);
+       if (satWindow == NULL)
+               return;
+       SATGroup* group = satWindow->GetGroup();
+       if (group == NULL)
+               return;
+       Desktop* desktop = satWindow->GetWindow()->Desktop();
+       if (desktop == NULL)
+               return;
+
+       const WindowAreaList& areaList = group->GetAreaList();
+       for (int32 i = 0; i < areaList.CountItems(); i++) {
+               WindowArea* area = areaList.ItemAt(i);
+               SATWindow* topWindow = area->TopWindow();
+               if (topWindow == NULL || topWindow == satWindow)
+                       continue;
+               desktop->SendWindowBehind(topWindow->GetWindow(), behindOf);
+       }
 }
 
 

############################################################################

Revision:    hrev44596
Commit:      7dd16a4c95aa5f0ef5ad9dbc2abf652cf6105619
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7dd16a4
Author:      czeidler <haiku@xxxxxxxxxxxxxxxxxx>
Date:        Sat Sep  1 02:56:06 2012 UTC

Fix crash when splitting a S&T group.

- Hold a ref to the old crossings till we cleaned up.
- Additionally use a safer method to delete constraints.
- Clean up.

----------------------------------------------------------------------------

diff --git a/src/servers/app/stackandtile/SATGroup.cpp 
b/src/servers/app/stackandtile/SATGroup.cpp
index e2c4e25..b27906d 100644
--- a/src/servers/app/stackandtile/SATGroup.cpp
+++ b/src/servers/app/stackandtile/SATGroup.cpp
@@ -47,7 +47,6 @@ WindowArea::WindowArea(Crossing* leftTop, Crossing* rightTop,
        fWidthConstraint(NULL),
        fHeightConstraint(NULL)
 {
-
 }
 
 
@@ -320,6 +319,12 @@ WindowArea::PropagateToGroup(SATGroup* group)
        if (!newLeftTop || !newRightTop || !newLeftBottom || !newRightBottom)
                return false;
 
+       // hold a ref to the crossings till we cleaned up everything
+       BReference<Crossing> oldLeftTop = fLeftTopCrossing;
+       BReference<Crossing> oldRightTop = fRightTopCrossing;
+       BReference<Crossing> oldLeftBottom = fLeftBottomCrossing;
+       BReference<Crossing> oldRightBottom = fRightBottomCrossing;
+
        fLeftTopCrossing = newLeftTop;
        fRightTopCrossing = newRightTop;
        fLeftBottomCrossing = newLeftBottom;
@@ -331,6 +336,7 @@ WindowArea::PropagateToGroup(SATGroup* group)
        // manage constraints
        if (Init(group) == false)
                return false;
+
        oldGroup->fWindowAreaList.RemoveItem(this);
        for (int32 i = 0; i < fWindowList.CountItems(); i++) {
                SATWindow* window = fWindowList.ItemAt(i);
@@ -360,12 +366,15 @@ WindowArea::MoveToTopLayer(SATWindow* window)
 void
 WindowArea::_UninitConstraints()
 {
-       delete fMinWidthConstraint;
-       delete fMinHeightConstraint;
-       delete fMaxWidthConstraint;
-       delete fMaxHeightConstraint;
-       delete fWidthConstraint;
-       delete fHeightConstraint;
+       LinearSpec* linearSpec = fGroup->GetLinearSpec();
+
+       linearSpec->RemoveConstraint(fMinWidthConstraint, true);
+       linearSpec->RemoveConstraint(fMinHeightConstraint, true);
+       linearSpec->RemoveConstraint(fMaxWidthConstraint, true);
+       linearSpec->RemoveConstraint(fMaxHeightConstraint, true);
+       linearSpec->RemoveConstraint(fWidthConstraint, true);
+       linearSpec->RemoveConstraint(fHeightConstraint, true);
+
        fMinWidthConstraint = NULL;
        fMinHeightConstraint = NULL;
        fMaxWidthConstraint = NULL;
@@ -1157,14 +1166,12 @@ SATGroup::_SplitGroupIfNecessary(WindowArea* 
removedArea)
        while (_FindConnectedGroup(neighbourWindows, removedArea, newGroup)) {
                STRACE_SAT("Connected group found; %i window(s)\n",
                        (int)newGroup.CountItems());
-
                if (newGroup.CountItems() == 1
                        && newGroup.ItemAt(0)->WindowList().CountItems() == 1) {
                        SATWindow* window = 
newGroup.ItemAt(0)->WindowList().ItemAt(0);
                        RemoveWindow(window);
                        _EnsureGroupIsOnScreen(window->GetGroup());
-               }
-               else if (ownGroupProcessed)
+               } else if (ownGroupProcessed)
                        _SpawnNewGroup(newGroup);
                else {
                        _EnsureGroupIsOnScreen(this);
diff --git a/src/servers/app/stackandtile/SATGroup.h 
b/src/servers/app/stackandtile/SATGroup.h
index 74b081a..80897d1 100644
--- a/src/servers/app/stackandtile/SATGroup.h
+++ b/src/servers/app/stackandtile/SATGroup.h
@@ -220,11 +220,9 @@ private:
                        Constraint*                     fMinHeightConstraint;
                        Constraint*                     fMaxWidthConstraint;
                        Constraint*                     fMaxHeightConstraint;
-                       Constraint*                     fKeepMaxWidthConstraint;
-                       Constraint*                     
fKeepMaxHeightConstraint;
                        Constraint*                     fWidthConstraint;
                        Constraint*                     fHeightConstraint;
-                       
+
                        MagneticBorder          fMagneticBorder;
 };
 


Other related posts: