diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.cpp b/src/add-ons/decorators/SATDecorator/SATWindow.cpp index e618849a89..cdf979fdb7 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.cpp +++ b/src/add-ons/decorators/SATDecorator/SATWindow.cpp @@ -73,13 +73,6 @@ GroupCookie::DoGroupLayout(SATWindow* triggerWindow) fLeftConstraint->SetRightSide(frame.left); fTopConstraint->SetRightSide(frame.top); - int32 minWidth, maxWidth, minHeight, maxHeight; - fSATWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - fMinWidthConstraint->SetRightSide(minWidth); - fMinHeightConstraint->SetRightSide(minHeight); - fMaxWidthConstraint->SetRightSide(maxWidth); - fMaxHeightConstraint->SetRightSide(maxHeight); - fWidthConstraint->SetPenaltyNeg(110); fWidthConstraint->SetPenaltyPos(110); fHeightConstraint->SetPenaltyNeg(110); @@ -136,6 +129,17 @@ GroupCookie::MoveWindow(int32 workspace) } +void +GroupCookie::SetSizeLimit(int32 minWidth, int32 maxWidth, int32 minHeight, + int32 maxHeight) +{ + fMinWidthConstraint->SetRightSide(minWidth); + fMinHeightConstraint->SetRightSide(minHeight); + fMaxWidthConstraint->SetRightSide(maxWidth); + fMaxHeightConstraint->SetRightSide(maxHeight); +} + + bool GroupCookie::Init(SATGroup* group, WindowArea* area) { @@ -170,8 +174,8 @@ GroupCookie::Init(SATGroup* group, WindowArea* area) fLeftBorder, OperatorType(GE), minWidth); fMinHeightConstraint = linearSpec->AddConstraint(1.0, fBottomBorder, -1.0, fTopBorder, OperatorType(GE), minHeight); - fMaxWidthConstraint = linearSpec->AddConstraint(1.0, fBottomBorder, -1.0, - fTopBorder, OperatorType(LE), maxHeight); + fMaxWidthConstraint = linearSpec->AddConstraint(1.0, fRightBorder, -1.0, + fLeftBorder, OperatorType(LE), maxWidth); fMaxHeightConstraint = linearSpec->AddConstraint(1.0, fBottomBorder, -1.0, fTopBorder, OperatorType(LE), maxHeight); @@ -371,6 +375,10 @@ SATWindow::AddedToGroup(SATGroup* group, WindowArea* area) return false; } + int32 minWidth, maxWidth, minHeight, maxHeight; + GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); + fGroupCookie->SetSizeLimit(minWidth, maxWidth, minHeight, maxHeight); + return true; } @@ -451,6 +459,7 @@ SATWindow::JoinCandidates() return false; bool status = fOngoingSnapping->JoinCandidates(); fOngoingSnapping = NULL; + return status; } @@ -475,6 +484,15 @@ SATWindow::DoGroupLayout() } +void +SATWindow::SizeLimitChanged(int32 minWidth, int32 maxWidth, int32 minHeight, + int32 maxHeight) +{ + GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); + fGroupCookie->SetSizeLimit(minWidth, maxWidth, minHeight, maxHeight); +} + + BRect SATWindow::CompleteWindowFrame() { diff --git a/src/add-ons/decorators/SATDecorator/SATWindow.h b/src/add-ons/decorators/SATDecorator/SATWindow.h index 331613b80f..25d25f8179 100644 --- a/src/add-ons/decorators/SATDecorator/SATWindow.h +++ b/src/add-ons/decorators/SATDecorator/SATWindow.h @@ -32,6 +32,8 @@ public: void DoGroupLayout(SATWindow* triggerWindow); void MoveWindow(int32 workspace); + void SetSizeLimit(int32 minWidth, int32 maxWidth, + int32 minHeight, int32 maxHeight); SATGroup* GetGroup() { return fSATGroup.Get(); } @@ -103,6 +105,9 @@ public: void DoWindowLayout(); void DoGroupLayout(); + void SizeLimitChanged(int32 minWidth, int32 maxWidth, + int32 minHeight, int32 maxHeight); + //! \return the complete window frame including the Decorator BRect CompleteWindowFrame(); void GetSizeLimits(int32* minWidth, int32* maxWidth, diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp index 081c7e8a43..961e1133e7 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.cpp +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.cpp @@ -290,6 +290,18 @@ StackAndTile::WindowTabLocationChanged(Window* window, float location) } +void +StackAndTile::SizeLimitChanged(Window* window, int32 minWidth, int32 maxWidth, + int32 minHeight, int32 maxHeight) +{ + SATWindow* satWindow = GetSATWindow(window); + if (!satWindow) + return; + + satWindow->SizeLimitChanged(minWidth, maxWidth, minHeight, maxHeight); +} + + bool StackAndTile::SetDecoratorSettings(Window* window, const BMessage& settings) { diff --git a/src/add-ons/decorators/SATDecorator/StackAndTile.h b/src/add-ons/decorators/SATDecorator/StackAndTile.h index c163a35d20..2baea23d48 100644 --- a/src/add-ons/decorators/SATDecorator/StackAndTile.h +++ b/src/add-ons/decorators/SATDecorator/StackAndTile.h @@ -37,65 +37,69 @@ typedef std::map SATWindowMap; class StackAndTile : public DesktopListener { public: - StackAndTile(); - virtual ~StackAndTile(); + StackAndTile(); + virtual ~StackAndTile(); - virtual int32 Identifier(); + virtual int32 Identifier(); // DesktopListener hooks - virtual void ListenerRegistered(Desktop* desktop); - virtual void ListenerUnregistered(); + virtual void ListenerRegistered(Desktop* desktop); + virtual void ListenerUnregistered(); - virtual bool HandleMessage(Window* sender, - BPrivate::ServerLink& link); + virtual bool HandleMessage(Window* sender, + BPrivate::ServerLink& link); - virtual void WindowAdded(Window* window); - virtual void WindowRemoved(Window* window); + virtual void WindowAdded(Window* window); + virtual void WindowRemoved(Window* window); - virtual void KeyPressed(uint32 what, int32 key, - int32 modifiers); - virtual void MouseEvent(BMessage* message) {} - virtual void MouseDown(Window* window, BMessage* message, + virtual void KeyPressed(uint32 what, int32 key, + int32 modifiers); + virtual void MouseEvent(BMessage* message) {} + virtual void MouseDown(Window* window, BMessage* message, const BPoint& where); - virtual void MouseUp(Window* window, BMessage* message, + virtual void MouseUp(Window* window, BMessage* message, const BPoint& where); - virtual void MouseMoved(Window* window, BMessage* message, + virtual void MouseMoved(Window* window, BMessage* message, const BPoint& where) {} - virtual void WindowMoved(Window* window); - virtual void WindowResized(Window* window); - virtual void WindowActitvated(Window* window); - virtual void WindowSentBehind(Window* window, Window* behindOf); - virtual void WindowWorkspacesChanged(Window* window, + virtual void WindowMoved(Window* window); + virtual void WindowResized(Window* window); + virtual void WindowActitvated(Window* window); + virtual void WindowSentBehind(Window* window, + Window* behindOf); + virtual void WindowWorkspacesChanged(Window* window, uint32 workspaces); - virtual void WindowMinimized(Window* window, bool minimize); + virtual void WindowMinimized(Window* window, bool minimize); - virtual void WindowTabLocationChanged(Window* window, - float location); + virtual void WindowTabLocationChanged(Window* window, + float location); + virtual void SizeLimitChanged(Window* window, int32 minWidth, + int32 maxWidth, int32 minHeight, + int32 maxHeight); - virtual bool SetDecoratorSettings(Window* window, - const BMessage& settings); - virtual void GetDecoratorSettings(Window* window, - BMessage& settings); + virtual bool SetDecoratorSettings(Window* window, + const BMessage& settings); + virtual void GetDecoratorSettings(Window* window, + BMessage& settings); - bool SATKeyPressed() - { return fSATKeyPressed; } + bool SATKeyPressed() + { return fSATKeyPressed; } - SATWindow* GetSATWindow(Window* window); + SATWindow* GetSATWindow(Window* window); private: - void _StartSAT(); - void _StopSAT(); - void _ActivateWindow(SATWindow* window); + void _StartSAT(); + void _StopSAT(); + void _ActivateWindow(SATWindow* window); - bool fSATKeyPressed; + bool fSATKeyPressed; - SATWindowMap fSATWindowMap; - SATWindowList fGrouplessWindows; + SATWindowMap fSATWindowMap; + SATWindowList fGrouplessWindows; - SATWindow* fCurrentSATWindow; + SATWindow* fCurrentSATWindow; - bool fTabIsShifting; + bool fTabIsShifting; }; diff --git a/src/servers/app/DesktopListener.cpp b/src/servers/app/DesktopListener.cpp index e7028b7d43..3d99f840e2 100644 --- a/src/servers/app/DesktopListener.cpp +++ b/src/servers/app/DesktopListener.cpp @@ -252,6 +252,21 @@ DesktopObservable::NotifyWindowTabLocationChanged(Window* window, } +void +DesktopObservable::NotifySizeLimitChanged(Window* window, int32 minWidth, + int32 maxWidth, int32 minHeight, int32 maxHeight) +{ + if (fWeAreInvoking) + return; + InvokeGuard invokeGuard(fWeAreInvoking); + + for (DesktopListener* listener = fDesktopListenerList.First(); + listener != NULL; listener = fDesktopListenerList.GetNext(listener)) + listener->SizeLimitChanged(window, minWidth, maxWidth, minHeight, + maxHeight); +} + + bool DesktopObservable::SetDecoratorSettings(Window* window, const BMessage& settings) diff --git a/src/servers/app/DesktopListener.h b/src/servers/app/DesktopListener.h index c2487a7554..39cd46a8eb 100644 --- a/src/servers/app/DesktopListener.h +++ b/src/servers/app/DesktopListener.h @@ -58,6 +58,9 @@ public: virtual void WindowTabLocationChanged(Window* window, float location) = 0; + virtual void SizeLimitChanged(Window* window, int32 minWidth, + int32 maxWidth, int32 minHeight, + int32 maxHeight) = 0; virtual bool SetDecoratorSettings(Window* window, const BMessage& settings) = 0; @@ -71,46 +74,49 @@ typedef DoublyLinkedList DesktopListenerDLList; class DesktopObservable { public: - DesktopObservable(); + DesktopObservable(); - void RegisterListener(DesktopListener* listener, - Desktop* desktop); - void UnregisterListener(DesktopListener* listener); + void RegisterListener(DesktopListener* listener, + Desktop* desktop); + void UnregisterListener(DesktopListener* listener); const DesktopListenerDLList& GetDesktopListenerList(); - bool MessageForListener(Window* sender, - BPrivate::ServerLink& link); + bool MessageForListener(Window* sender, + BPrivate::ServerLink& link); - void NotifyWindowAdded(Window* window); - void NotifyWindowRemoved(Window* window); + void NotifyWindowAdded(Window* window); + void NotifyWindowRemoved(Window* window); - void NotifyKeyPressed(uint32 what, int32 key, - int32 modifiers); - void NotifyMouseEvent(BMessage* message); - void NotifyMouseDown(Window* window, BMessage* message, - const BPoint& where); - void NotifyMouseUp(Window* window, BMessage* message, - const BPoint& where); - void NotifyMouseMoved(Window* window, BMessage* message, - const BPoint& where); + void NotifyKeyPressed(uint32 what, int32 key, + int32 modifiers); + void NotifyMouseEvent(BMessage* message); + void NotifyMouseDown(Window* window, + BMessage* message, const BPoint& where); + void NotifyMouseUp(Window* window, BMessage* message, + const BPoint& where); + void NotifyMouseMoved(Window* window, + BMessage* message, const BPoint& where); - void NotifyWindowMoved(Window* window); - void NotifyWindowResized(Window* window); - void NotifyWindowActitvated(Window* window); - void NotifyWindowSentBehind(Window* window, - Window* behindOf); - void NotifyWindowWorkspacesChanged(Window* window, + void NotifyWindowMoved(Window* window); + void NotifyWindowResized(Window* window); + void NotifyWindowActitvated(Window* window); + void NotifyWindowSentBehind(Window* window, + Window* behindOf); + void NotifyWindowWorkspacesChanged(Window* window, uint32 workspaces); - void NotifyWindowMinimized(Window* window, - bool minimize); + void NotifyWindowMinimized(Window* window, + bool minimize); - void NotifyWindowTabLocationChanged(Window* window, - float location); + void NotifyWindowTabLocationChanged(Window* window, + float location); + void NotifySizeLimitChanged(Window* window, + int32 minWidth, int32 maxWidth, + int32 minHeight, int32 maxHeight); - bool SetDecoratorSettings(Window* window, - const BMessage& settings); - void GetDecoratorSettings(Window* window, - BMessage& settings); + bool SetDecoratorSettings(Window* window, + const BMessage& settings); + void GetDecoratorSettings(Window* window, + BMessage& settings); private: class InvokeGuard { diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 22326710bd..b6a7d0b359 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -961,6 +961,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) fLink.Attach((float)maxHeight); fLink.Flush(); + + fDesktop->NotifySizeLimitChanged(fWindow, minWidth, maxWidth, + minHeight, maxHeight); break; }