From dd169d9e23c6a24b4d2e10c717f6d1625720eef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 14 Mar 2009 13:55:14 +0000 Subject: [PATCH] * 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 --- src/servers/app/WorkspacesView.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/servers/app/WorkspacesView.cpp b/src/servers/app/WorkspacesView.cpp index 3e10334125..6ef5d0a347 100644 --- a/src/servers/app/WorkspacesView.cpp +++ b/src/servers/app/WorkspacesView.cpp @@ -547,14 +547,19 @@ WorkspacesView::MouseMoved(BMessage* message, BPoint where) if (fSelectedWorkspace == Window()->Desktop()->CurrentWorkspace()) leftTop = fSelectedWindow->Frame().LeftTop(); else { - if (fSelectedWindow->Anchor(fSelectedWorkspace).position == kInvalidWindowPosition) - fSelectedWindow->Anchor(fSelectedWorkspace).position = fSelectedWindow->Frame().LeftTop(); + if (fSelectedWindow->Anchor(fSelectedWorkspace).position + == kInvalidWindowPosition) { + fSelectedWindow->Anchor(fSelectedWorkspace).position + = fSelectedWindow->Frame().LeftTop(); + } leftTop = fSelectedWindow->Anchor(fSelectedWorkspace).position; } - float diff = (fClickPoint.x - where.x) * (fClickPoint.x - where.x) - + (fClickPoint.y - where.y) * (fClickPoint.y - where.y); - if (!fHasMoved && diff > 4) + // Don't treat every little mouse move as a window move - this would + // make it too hard to activate a workspace. + float diff = max(fabs(fClickPoint.x - where.x), + fabs(fClickPoint.y - where.y)); + if (!fHasMoved && diff > 2) fHasMoved = true; if (fHasMoved) {