From 7306ba04487ad91c70aa4511f450fab9a1fe5ce2 Mon Sep 17 00:00:00 2001 From: Clemens Zeidler Date: Sun, 19 Sep 2010 21:46:42 +0000 Subject: [PATCH] Watch the window look and remove a window from a S&T group if the look changed to B_NO_BORDER_WINDOW_LOOK. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38731 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../decorators/SATDecorator/StackAndTile.cpp | 25 ++++++++++++++++--- .../decorators/SATDecorator/StackAndTile.h | 2 ++ src/servers/app/Desktop.cpp | 2 ++ src/servers/app/DesktopListener.cpp | 13 ++++++++++ src/servers/app/DesktopListener.h | 5 ++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp index 9c93eb04fa..aa99a80e42 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp @@ -281,7 +281,7 @@ StackAndTile::WindowMinimized(Window* window, bool minimize) void StackAndTile::WindowTabLocationChanged(Window* window, float location) { - SATWindow* satWindow = GetSATWindow(window); + SATWindow* satWindow = GetSATWindow(window); if (!satWindow) return; @@ -294,7 +294,7 @@ void StackAndTile::SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight) { - SATWindow* satWindow = GetSATWindow(window); + SATWindow* satWindow = GetSATWindow(window); if (!satWindow) return; WindowArea* area = satWindow->GetWindowArea(); @@ -304,10 +304,27 @@ StackAndTile::SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, } +void +StackAndTile::WindowLookChanged(Window* window, window_look look) +{ + // if the decorator has been removed remove it from the stacking group + if (look != B_NO_BORDER_WINDOW_LOOK) + return; + + SATWindow* satWindow = GetSATWindow(window); + if (!satWindow) + return; + SATGroup* group = satWindow->GetGroup(); + if (!group) + return; + group->RemoveWindow(satWindow); +} + + bool StackAndTile::SetDecoratorSettings(Window* window, const BMessage& settings) { - SATWindow* satWindow = GetSATWindow(window); + SATWindow* satWindow = GetSATWindow(window); if (!satWindow) return false; @@ -319,7 +336,7 @@ StackAndTile::SetDecoratorSettings(Window* window, const BMessage& settings) void StackAndTile::GetDecoratorSettings(Window* window, BMessage& settings) { - SATWindow* satWindow = GetSATWindow(window); + SATWindow* satWindow = GetSATWindow(window); if (!satWindow) return; diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.h b/src/add-ons/decorators/SATDecorator/StackAndTile.h index c6b72bb2f9..2c6d9390af 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.h +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.h @@ -76,6 +76,8 @@ public: virtual void SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight); + virtual void WindowLookChanged(Window* window, + window_look look); virtual bool SetDecoratorSettings(Window* window, const BMessage& settings); diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 240d32c74a..0ef145497f 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1491,6 +1491,8 @@ Desktop::SetWindowLook(Window* window, window_look newLook) // finds out it needs to resize itself... RebuildAndRedrawAfterWindowChange(window, dirty); + + NotifyWindowLookChanged(window, newLook); } diff --git a/src/servers/app/DesktopListener.cpp b/src/servers/app/DesktopListener.cpp index a8cfbd975b..4f7c59184d 100644 --- a/src/servers/app/DesktopListener.cpp +++ b/src/servers/app/DesktopListener.cpp @@ -267,6 +267,19 @@ DesktopObservable::NotifySizeLimitsChanged(Window* window, int32 minWidth, } +void +DesktopObservable::NotifyWindowLookChanged(Window* window, window_look look) +{ + if (fWeAreInvoking) + return; + InvokeGuard invokeGuard(fWeAreInvoking); + + for (DesktopListener* listener = fDesktopListenerList.First(); + listener != NULL; listener = fDesktopListenerList.GetNext(listener)) + listener->WindowLookChanged(window, look); +} + + bool DesktopObservable::SetDecoratorSettings(Window* window, const BMessage& settings) diff --git a/src/servers/app/DesktopListener.h b/src/servers/app/DesktopListener.h index 368d715e68..dc6e445052 100644 --- a/src/servers/app/DesktopListener.h +++ b/src/servers/app/DesktopListener.h @@ -14,6 +14,7 @@ #include #include +#include "Window.h" class BMessage; @@ -61,6 +62,8 @@ public: virtual void SizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight) = 0; + virtual void WindowLookChanged(Window* window, + window_look look) = 0; virtual bool SetDecoratorSettings(Window* window, const BMessage& settings) = 0; @@ -112,6 +115,8 @@ public: void NotifySizeLimitsChanged(Window* window, int32 minWidth, int32 maxWidth, int32 minHeight, int32 maxHeight); + void NotifyWindowLookChanged(Window* window, + window_look look); bool SetDecoratorSettings(Window* window, const BMessage& settings);