fixed weird resize behaviour (the mouse cursor returns to the initial drag offset after the window has been resized more than the resize limits allow)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15638 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-12-21 13:49:19 +00:00
parent 79f73dbc56
commit 5659f08c68
+15 -6
View File
@@ -688,7 +688,7 @@ WindowLayer::MarkContentDirty(BRegion& regionOnScreen)
void void
WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion) WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion)
{ {
if (layer && !fHidden && fDesktop && fDesktop->LockSingleWindow()) { if (layer && IsVisible() && fDesktop && fDesktop->LockSingleWindow()) {
if (!layer->IsVisible()) { if (!layer->IsVisible()) {
fDesktop->UnlockSingleWindow(); fDesktop->UnlockSingleWindow();
return; return;
@@ -928,9 +928,14 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
BPoint delta = where - fLastMousePosition; BPoint delta = where - fLastMousePosition;
// moving // moving
if (fIsDragging) { if (fIsDragging) {
if (!(Flags() & B_NOT_MOVABLE)) if (!(Flags() & B_NOT_MOVABLE)) {
BPoint oldLeftTop = fFrame.LeftTop();
fDesktop->MoveWindowBy(this, delta.x, delta.y); fDesktop->MoveWindowBy(this, delta.x, delta.y);
else
// constrain delta to true change in size
delta = fFrame.LeftTop() - oldLeftTop;
} else
delta = BPoint(0, 0); delta = BPoint(0, 0);
} }
// resizing // resizing
@@ -940,8 +945,13 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
delta.y = 0; delta.y = 0;
if (Flags() & B_NOT_H_RESIZABLE) if (Flags() & B_NOT_H_RESIZABLE)
delta.x = 0; delta.x = 0;
BPoint oldRightBottom = fFrame.RightBottom();
fDesktop->ResizeWindowBy(this, delta.x, delta.y); fDesktop->ResizeWindowBy(this, delta.x, delta.y);
// constrain delta to true change in size
delta = fFrame.RightBottom() - oldRightBottom;
} else } else
delta = BPoint(0, 0); delta = BPoint(0, 0);
} }
@@ -952,7 +962,6 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
// NOTE: fLastMousePosition is currently only // NOTE: fLastMousePosition is currently only
// used for window moving/resizing/sliding the tab // used for window moving/resizing/sliding the tab
// ther
fLastMousePosition += delta; fLastMousePosition += delta;
// change focus in FFM mode // change focus in FFM mode
@@ -1546,7 +1555,7 @@ WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
void void
WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion) WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion)
{ {
if (dirtyContentRegion.CountRects() > 0) { if (IsVisible() && dirtyContentRegion.CountRects() > 0) {
// put this into the pending dirty region // put this into the pending dirty region
// to eventually trigger a client redraw // to eventually trigger a client redraw
_TransferToUpdateSession(&dirtyContentRegion); _TransferToUpdateSession(&dirtyContentRegion);