* Reworked the code that ignores a little jitter in mouse movements when

trying to switch the workspace. Not sure why it didn't behave previously,
  but it seems to work fine now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29514 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-03-14 13:55:14 +00:00
parent 7aed1511f6
commit dd169d9e23

View File

@ -547,14 +547,19 @@ WorkspacesView::MouseMoved(BMessage* message, BPoint where)
if (fSelectedWorkspace == Window()->Desktop()->CurrentWorkspace()) if (fSelectedWorkspace == Window()->Desktop()->CurrentWorkspace())
leftTop = fSelectedWindow->Frame().LeftTop(); leftTop = fSelectedWindow->Frame().LeftTop();
else { else {
if (fSelectedWindow->Anchor(fSelectedWorkspace).position == kInvalidWindowPosition) if (fSelectedWindow->Anchor(fSelectedWorkspace).position
fSelectedWindow->Anchor(fSelectedWorkspace).position = fSelectedWindow->Frame().LeftTop(); == kInvalidWindowPosition) {
fSelectedWindow->Anchor(fSelectedWorkspace).position
= fSelectedWindow->Frame().LeftTop();
}
leftTop = fSelectedWindow->Anchor(fSelectedWorkspace).position; leftTop = fSelectedWindow->Anchor(fSelectedWorkspace).position;
} }
float diff = (fClickPoint.x - where.x) * (fClickPoint.x - where.x) // Don't treat every little mouse move as a window move - this would
+ (fClickPoint.y - where.y) * (fClickPoint.y - where.y); // make it too hard to activate a workspace.
if (!fHasMoved && diff > 4) float diff = max(fabs(fClickPoint.x - where.x),
fabs(fClickPoint.y - where.y));
if (!fHasMoved && diff > 2)
fHasMoved = true; fHasMoved = true;
if (fHasMoved) { if (fHasMoved) {