From 8490a52529446a79b832debc7d343436e2ac799b Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 2 Dec 2010 18:12:18 +0000 Subject: [PATCH] Added some resizable checks that were missing. Now, borders that can be resize are not highlight anymore, and it's no more possible to resize a non-resizable (vertical/horizontal/all directions) window with the third button + CMD + ALT. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39705 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/DefaultWindowBehaviour.cpp | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/servers/app/DefaultWindowBehaviour.cpp b/src/servers/app/DefaultWindowBehaviour.cpp index 2266753453..4e7f8c9686 100644 --- a/src/servers/app/DefaultWindowBehaviour.cpp +++ b/src/servers/app/DefaultWindowBehaviour.cpp @@ -432,6 +432,15 @@ struct DefaultWindowBehaviour::ResizeBorderState : MouseTrackingState { virtual void EnterState(State* previousState) { + if ((fWindow->Flags() & B_NOT_RESIZABLE) != 0) + fHorizontal = fVertical = NONE; + else { + if ((fWindow->Flags() & B_NOT_H_RESIZABLE) != 0) + fHorizontal = NONE; + + if ((fWindow->Flags() & B_NOT_V_RESIZABLE) != 0) + fVertical = NONE; + } fBehavior._SetResizeCursor(fHorizontal, fVertical); } @@ -442,14 +451,9 @@ struct DefaultWindowBehaviour::ResizeBorderState : MouseTrackingState { virtual void MouseMovedAction(BPoint& delta, bigtime_t now) { - if ((fWindow->Flags() & B_NOT_RESIZABLE) != 0) { - delta = BPoint(0, 0); - return; - } - - if ((fWindow->Flags() & B_NOT_H_RESIZABLE) != 0 || fHorizontal == NONE) + if (fHorizontal == NONE) delta.x = 0; - if ((fWindow->Flags() & B_NOT_V_RESIZABLE) != 0 || fVertical == NONE) + if (fVertical == NONE) delta.y = 0; if (delta.x == 0 && delta.y == 0) @@ -656,6 +660,9 @@ struct DefaultWindowBehaviour::ManageWindowState : State { private: void _UpdateBorders(BPoint where) { + if ((fWindow->Flags() & B_NOT_RESIZABLE) != 0) + return; + // Compute the window center relative location of where. We divide by // the width respective the height, so we compensate for the window's // aspect ratio. @@ -673,6 +680,11 @@ private: int8 vertical; _ComputeResizeDirection(x, y, horizontal, vertical); + if ((fWindow->Flags() & B_NOT_H_RESIZABLE) != 0) + horizontal = NONE; + if ((fWindow->Flags() & B_NOT_V_RESIZABLE) != 0) + vertical = NONE; + // update the highlight, if necessary if (horizontal != fHorizontal || vertical != fVertical) { fBehavior._SetBorderHighlights(fHorizontal, fVertical, false); @@ -892,8 +904,10 @@ DefaultWindowBehaviour::MouseDown(BMessage* message, BPoint where, } else if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) { // Middle-click anywhere on the window shall initiate // humdinger-resize mode. - if (windowModifier && hitRegion != Decorator::REGION_NONE) - action = ACTION_HUMDINGER_RESIZE; + if (windowModifier && hitRegion != Decorator::REGION_NONE) { + action = (flags & B_NOT_RESIZABLE) == 0 + ? ACTION_HUMDINGER_RESIZE : ACTION_DRAG; + } } }