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

View File

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