From 3add2e79b7cd5472667d04ec02d72f72c932f68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 11 Oct 2008 20:06:04 +0000 Subject: [PATCH] * If you click on a window in the Workspaces view, it won't move until you move the mouse a bit more. This should help with "fast" workspace switches when you click on a workspace and accidently move the mouse a bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27977 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/WorkspacesView.cpp | 12 +++++++++--- src/servers/app/WorkspacesView.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/servers/app/WorkspacesView.cpp b/src/servers/app/WorkspacesView.cpp index 67487ea8d1..90c92de2f0 100644 --- a/src/servers/app/WorkspacesView.cpp +++ b/src/servers/app/WorkspacesView.cpp @@ -467,6 +467,7 @@ WorkspacesView::MouseDown(BMessage* message, BPoint where) fLeftTopOffset = where - windowFrame.LeftTop(); fSelectedWorkspace = index; + fClickPoint = where; if (index >= 0) _Invalidate(); @@ -550,10 +551,15 @@ WorkspacesView::MouseMoved(BMessage* message, BPoint where) leftTop = fSelectedWindow->Anchor(fSelectedWorkspace).position; } - Window()->Desktop()->MoveWindowBy(fSelectedWindow, left - leftTop.x, top - leftTop.y, - fSelectedWorkspace); + float diff = (fClickPoint.x - where.x) * (fClickPoint.x - where.x) + + (fClickPoint.y - where.y) * (fClickPoint.y - where.y); + if (!fHasMoved && diff > 4) + fHasMoved = true; - fHasMoved = true; + if (fHasMoved) { + Window()->Desktop()->MoveWindowBy(fSelectedWindow, left - leftTop.x, + top - leftTop.y, fSelectedWorkspace); + } } diff --git a/src/servers/app/WorkspacesView.h b/src/servers/app/WorkspacesView.h index 58c3fff306..a34b54a4fd 100644 --- a/src/servers/app/WorkspacesView.h +++ b/src/servers/app/WorkspacesView.h @@ -56,6 +56,7 @@ private: ::Window* fSelectedWindow; int32 fSelectedWorkspace; bool fHasMoved; + BPoint fClickPoint; BPoint fLeftTopOffset; };