Store the stacking order to restore it if a window changed its layer position.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38517 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7fe05355e3
commit
a6771397dc
@ -84,6 +84,7 @@ WindowArea::_AddWindow(SATWindow* window, SATWindow* after)
|
|||||||
if (fWindowList.CountItems() <= 1)
|
if (fWindowList.CountItems() <= 1)
|
||||||
_InitCorners();
|
_InitCorners();
|
||||||
|
|
||||||
|
fWindowLayerOrder.AddItem(window);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +95,7 @@ WindowArea::_RemoveWindow(SATWindow* window)
|
|||||||
if (!fWindowList.RemoveItem(window))
|
if (!fWindowList.RemoveItem(window))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
fWindowLayerOrder.RemoveItem(window);
|
||||||
window->RemovedFromArea(this);
|
window->RemovedFromArea(this);
|
||||||
ReleaseReference();
|
ReleaseReference();
|
||||||
return true;
|
return true;
|
||||||
@ -165,6 +167,15 @@ WindowArea::PropagateToGroup(SATGroup* group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
WindowArea::MoveToTopLayer(SATWindow* window)
|
||||||
|
{
|
||||||
|
if (!fWindowLayerOrder.RemoveItem(window))
|
||||||
|
return false;
|
||||||
|
return fWindowLayerOrder.AddItem(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BReference<Crossing>
|
BReference<Crossing>
|
||||||
WindowArea::_CrossingByPosition(Crossing* crossing, SATGroup* group)
|
WindowArea::_CrossingByPosition(Crossing* crossing, SATGroup* group)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,7 @@ public:
|
|||||||
bool SetGroup(SATGroup* group);
|
bool SetGroup(SATGroup* group);
|
||||||
|
|
||||||
const SATWindowList& WindowList() { return fWindowList; }
|
const SATWindowList& WindowList() { return fWindowList; }
|
||||||
|
const SATWindowList& LayerOrder() { return fWindowLayerOrder; }
|
||||||
bool MoveWindowToPosition(SATWindow* window,
|
bool MoveWindowToPosition(SATWindow* window,
|
||||||
int32 index);
|
int32 index);
|
||||||
|
|
||||||
@ -154,6 +155,8 @@ public:
|
|||||||
|
|
||||||
bool PropagateToGroup(SATGroup* group);
|
bool PropagateToGroup(SATGroup* group);
|
||||||
|
|
||||||
|
bool MoveToTopLayer(SATWindow* window);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class SATGroup;
|
friend class SATGroup;
|
||||||
/*! SATGroup adds new windows to the area. */
|
/*! SATGroup adds new windows to the area. */
|
||||||
@ -180,6 +183,8 @@ private:
|
|||||||
|
|
||||||
SATWindowList fWindowList;
|
SATWindowList fWindowList;
|
||||||
|
|
||||||
|
SATWindowList fWindowLayerOrder;
|
||||||
|
|
||||||
BReference<Crossing> fLeftTopCrossing;
|
BReference<Crossing> fLeftTopCrossing;
|
||||||
BReference<Crossing> fRightTopCrossing;
|
BReference<Crossing> fRightTopCrossing;
|
||||||
BReference<Crossing> fLeftBottomCrossing;
|
BReference<Crossing> fLeftBottomCrossing;
|
||||||
@ -214,6 +219,8 @@ public:
|
|||||||
int32 CountItems();
|
int32 CountItems();
|
||||||
SATWindow* WindowAt(int32 index);
|
SATWindow* WindowAt(int32 index);
|
||||||
|
|
||||||
|
const WindowAreaList& GetAreaList() { return fWindowAreaList; }
|
||||||
|
|
||||||
/*! \return a sorted tab list. */
|
/*! \return a sorted tab list. */
|
||||||
const TabList* HorizontalTabs();
|
const TabList* HorizontalTabs();
|
||||||
const TabList* VerticalTabs();
|
const TabList* VerticalTabs();
|
||||||
|
@ -220,8 +220,9 @@ StackAndTile::WindowSentBehind(Window* window, Window* behindOf)
|
|||||||
if (!desktop)
|
if (!desktop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < group->CountItems(); i++) {
|
WindowIterator iter(group, true);
|
||||||
SATWindow* listWindow = group->WindowAt(i);
|
for (SATWindow* listWindow = iter.NextWindow(); listWindow != NULL;
|
||||||
|
listWindow = iter.NextWindow()) {
|
||||||
if (listWindow != satWindow)
|
if (listWindow != satWindow)
|
||||||
desktop->SendWindowBehind(listWindow->GetWindow(), behindOf);
|
desktop->SendWindowBehind(listWindow->GetWindow(), behindOf);
|
||||||
}
|
}
|
||||||
@ -367,16 +368,20 @@ StackAndTile::_ActivateWindow(SATWindow* satWindow)
|
|||||||
Desktop* desktop = satWindow->GetWindow()->Desktop();
|
Desktop* desktop = satWindow->GetWindow()->Desktop();
|
||||||
if (!desktop)
|
if (!desktop)
|
||||||
return;
|
return;
|
||||||
|
WindowArea* area = satWindow->GetWindowArea();
|
||||||
|
if (!area)
|
||||||
|
return;
|
||||||
|
area->MoveToTopLayer(satWindow);
|
||||||
|
|
||||||
//desktop->ActivateWindow(satWindow->GetWindow());
|
//desktop->ActivateWindow(satWindow->GetWindow());
|
||||||
|
|
||||||
for (int i = 0; i < group->CountItems(); i++) {
|
WindowIterator iter(group);
|
||||||
SATWindow* listWindow = group->WindowAt(i);
|
for (SATWindow* listWindow = iter.NextWindow(); listWindow != NULL;
|
||||||
if (listWindow == satWindow)
|
listWindow = iter.NextWindow()) {
|
||||||
continue;
|
if (listWindow != satWindow)
|
||||||
//desktop->SendWindowBehind(listWindow->GetWindow(),
|
//desktop->SendWindowBehind(listWindow->GetWindow(),
|
||||||
// satWindow->GetWindow());
|
// satWindow->GetWindow());
|
||||||
desktop->ActivateWindow(listWindow->GetWindow());
|
desktop->ActivateWindow(listWindow->GetWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
desktop->ActivateWindow(satWindow->GetWindow());
|
desktop->ActivateWindow(satWindow->GetWindow());
|
||||||
@ -426,6 +431,71 @@ GroupIterator::NextGroup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WindowIterator::WindowIterator(SATGroup* group, bool reverseLayerOrder)
|
||||||
|
:
|
||||||
|
fGroup(group),
|
||||||
|
fReverseLayerOrder(reverseLayerOrder)
|
||||||
|
{
|
||||||
|
if (fReverseLayerOrder)
|
||||||
|
_ReverseRewind();
|
||||||
|
else
|
||||||
|
Rewind();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WindowIterator::Rewind()
|
||||||
|
{
|
||||||
|
fAreaIndex = 0;
|
||||||
|
fWindowIndex = 0;
|
||||||
|
fCurrentArea = fGroup->GetAreaList().ItemAt(fAreaIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SATWindow*
|
||||||
|
WindowIterator::NextWindow()
|
||||||
|
{
|
||||||
|
if (fReverseLayerOrder)
|
||||||
|
return _ReverseNextWindow();
|
||||||
|
|
||||||
|
if (fWindowIndex == fCurrentArea->LayerOrder().CountItems()) {
|
||||||
|
fAreaIndex++;
|
||||||
|
fWindowIndex = 0;
|
||||||
|
fCurrentArea = fGroup->GetAreaList().ItemAt(fAreaIndex);
|
||||||
|
if (!fCurrentArea)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
SATWindow* window = fCurrentArea->LayerOrder().ItemAt(fWindowIndex);
|
||||||
|
fWindowIndex++;
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SATWindow*
|
||||||
|
WindowIterator::_ReverseNextWindow()
|
||||||
|
{
|
||||||
|
if (fWindowIndex < 0) {
|
||||||
|
fAreaIndex++;
|
||||||
|
fCurrentArea = fGroup->GetAreaList().ItemAt(fAreaIndex);
|
||||||
|
if (!fCurrentArea)
|
||||||
|
return NULL;
|
||||||
|
fWindowIndex = fCurrentArea->LayerOrder().CountItems() - 1;
|
||||||
|
}
|
||||||
|
SATWindow* window = fCurrentArea->LayerOrder().ItemAt(fWindowIndex);
|
||||||
|
fWindowIndex--;
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WindowIterator::_ReverseRewind()
|
||||||
|
{
|
||||||
|
Rewind();
|
||||||
|
if (fCurrentArea)
|
||||||
|
fWindowIndex = fCurrentArea->LayerOrder().CountItems() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SATSnappingBehaviour::~SATSnappingBehaviour()
|
SATSnappingBehaviour::~SATSnappingBehaviour()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -114,6 +114,32 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WindowIterator {
|
||||||
|
public:
|
||||||
|
WindowIterator(SATGroup* group,
|
||||||
|
bool reverseLayerOrder = false);
|
||||||
|
|
||||||
|
void Rewind();
|
||||||
|
/*! Iterates over all areas in the group and return the windows in the
|
||||||
|
areas. Within on area the windows are ordered by layer position. The
|
||||||
|
bottommost window comes first. */
|
||||||
|
SATWindow* NextWindow();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*! The windows in the area are returned in reverse order. */
|
||||||
|
SATWindow* _ReverseNextWindow();
|
||||||
|
void _ReverseRewind();
|
||||||
|
|
||||||
|
SATGroup* fGroup;
|
||||||
|
bool fReverseLayerOrder;
|
||||||
|
|
||||||
|
WindowArea* fCurrentArea;
|
||||||
|
int32 fAreaIndex;
|
||||||
|
int32 fWindowIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SATSnappingBehaviour {
|
class SATSnappingBehaviour {
|
||||||
public:
|
public:
|
||||||
virtual ~SATSnappingBehaviour();
|
virtual ~SATSnappingBehaviour();
|
||||||
|
Loading…
Reference in New Issue
Block a user