- Add size limit changes to the listener interface.
- Update size limit constraints in S&T only if necessary. - Header style fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38682 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d2cf4da51f
commit
dcbc4af5d1
@ -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()
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -37,65 +37,69 @@ typedef std::map<Window*, SATWindow*> 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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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<DesktopListener> 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 {
|
||||
|
@ -961,6 +961,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
||||
fLink.Attach<float>((float)maxHeight);
|
||||
|
||||
fLink.Flush();
|
||||
|
||||
fDesktop->NotifySizeLimitChanged(fWindow, minWidth, maxWidth,
|
||||
minHeight, maxHeight);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user