A decorator can change during the lifetime of a window so get a fresh decorator every time.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38729 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2010-09-19 21:08:47 +00:00
parent a4dab27fab
commit e0c538ed7d
2 changed files with 28 additions and 16 deletions

View File

@ -297,7 +297,6 @@ SATWindow::SATWindow(StackAndTile* sat, Window* window)
fSATTiling(this),
fShutdown(false)
{
fDecorator = dynamic_cast<SATDecorator*>(fWindow->Decorator());
fDesktop = fWindow->Desktop();
fGroupCookie = &fOwnGroupCookie;
@ -319,6 +318,13 @@ SATWindow::~SATWindow()
}
SATDecorator*
SATWindow::GetDecorator()
{
return static_cast<SATDecorator*>(fWindow->Decorator());
}
SATGroup*
SATWindow::GetGroup()
{
@ -540,14 +546,15 @@ SATWindow::PositionManagedBySAT()
bool
SATWindow::HighlightTab(bool active)
{
if (!fDecorator)
SATDecorator* decorator = GetDecorator();
if (!decorator)
return false;
if (IsTabHighlighted() == active)
return false;
BRegion dirty;
fDecorator->HighlightTab(active, &dirty);
decorator->HighlightTab(active, &dirty);
fWindow->ProcessDirtyRegion(dirty);
return true;
@ -557,14 +564,15 @@ SATWindow::HighlightTab(bool active)
bool
SATWindow::HighlightBorders(bool active)
{
if (!fDecorator)
SATDecorator* decorator = GetDecorator();
if (!decorator)
return false;
if (IsBordersHighlighted() == active)
return false;
BRegion dirty;
fDecorator->HighlightBorders(active, &dirty);
decorator->HighlightBorders(active, &dirty);
fWindow->ProcessDirtyRegion(dirty);
return true;
}
@ -573,8 +581,9 @@ SATWindow::HighlightBorders(bool active)
bool
SATWindow::IsTabHighlighted()
{
if (fDecorator)
return fDecorator->IsTabHighlighted();
SATDecorator* decorator = GetDecorator();
if (decorator)
return decorator->IsTabHighlighted();
return false;
}
@ -582,8 +591,9 @@ SATWindow::IsTabHighlighted()
bool
SATWindow::IsBordersHighlighted()
{
if (fDecorator)
return fDecorator->IsBordersHighlighted();
SATDecorator* decorator = GetDecorator();
if (decorator)
return decorator->IsBordersHighlighted();
return false;
}
@ -591,10 +601,11 @@ SATWindow::IsBordersHighlighted()
bool
SATWindow::SetStackedMode(bool stacked)
{
if (!fDecorator)
SATDecorator* decorator = GetDecorator();
if (!decorator)
return false;
BRegion dirty;
fDecorator->SetStackedMode(stacked, &dirty);
decorator->SetStackedMode(stacked, &dirty);
fDesktop->RebuildAndRedrawAfterWindowChange(fWindow, dirty);
return true;
}
@ -603,10 +614,11 @@ SATWindow::SetStackedMode(bool stacked)
bool
SATWindow::SetStackedTabLength(float length)
{
if (!fDecorator)
SATDecorator* decorator = GetDecorator();
if (!decorator)
return false;
BRegion dirty;
fDecorator->SetStackedTabLength(length, &dirty);
decorator->SetStackedTabLength(length, &dirty);
fDesktop->RebuildAndRedrawAfterWindowChange(fWindow, dirty);
return true;
}
@ -615,7 +627,8 @@ SATWindow::SetStackedTabLength(float length)
bool
SATWindow::SetStackedTabMoving(bool moving)
{
if (!fDecorator)
SATDecorator* decorator = GetDecorator();
if (!decorator)
return false;
if (!moving)

View File

@ -77,7 +77,7 @@ public:
~SATWindow();
Window* GetWindow() { return fWindow; }
SATDecorator* GetDecorator() { return fDecorator; }
SATDecorator* GetDecorator();
StackAndTile* GetStackAndTile() { return fStackAndTile; }
Desktop* GetDesktop() { return fDesktop; }
//! Can be NULL if memory allocation failed!
@ -130,7 +130,6 @@ private:
void _InitGroup();
Window* fWindow;
SATDecorator* fDecorator;
StackAndTile* fStackAndTile;
Desktop* fDesktop;