Tracker: Double-Click simplification

Double-click check was redoing what is essentially already done in input_server.

The way we were doing it, right clicking (or pressing a different button for the second click,
for that matter) wasn't clearing the fields remembered and thus not breaking the sequence.
So a third click returning to the correct sequence (in a short time) would get recognized
as a valid second click.  So a quick left-right-left would be seen by that method as left-left.

Also, clean up a previous fix I committed.  Removed the introduced Origin() method as it
is the LeftTop() method I was interested in and it is already existing.

Fix #8714
This commit is contained in:
Philippe Saint-Pierre 2012-08-18 22:13:09 -04:00
parent efb1039348
commit ed63a5d20c
3 changed files with 4 additions and 26 deletions

View File

@ -230,7 +230,6 @@ BPoseView::BPoseView(Model* model, BRect bounds, uint32 viewMode,
fAlreadySelectedDropTarget(NULL),
fSelectionHandler(be_app),
fLastClickPt(LONG_MAX, LONG_MAX),
fLastClickTime(0),
fLastClickedPose(NULL),
fLastExtent(LONG_MAX, LONG_MAX, LONG_MIN, LONG_MIN),
fTitleView(NULL),
@ -7149,16 +7148,6 @@ BPoseView::SetTextWidgetToCheck(BTextWidget* widget, BTextWidget* old)
}
BPoint
BPoseView::Origin()
{
if (ViewMode() == kListMode)
return fViewState->ListOrigin();
return fViewState->IconOrigin();
}
void
BPoseView::MouseUp(BPoint where)
{
@ -7230,24 +7219,16 @@ BPoseView::WasClickInPath(const BPose* pose, int32 index, BPoint mouseLoc) const
bool
BPoseView::WasDoubleClick(const BPose* pose, BPoint point)
{
// check time and proximity
// check proximity
BPoint delta = point - fLastClickPt;
int32 clicks = Window()->CurrentMessage()->FindInt32("clicks");
bigtime_t sysTime;
Window()->CurrentMessage()->FindInt64("when", &sysTime);
bigtime_t timeDelta = sysTime - fLastClickTime;
bigtime_t doubleClickSpeed;
get_click_speed(&doubleClickSpeed);
if (timeDelta < doubleClickSpeed
if (clicks == 2
&& fabs(delta.x) < kDoubleClickTresh
&& fabs(delta.y) < kDoubleClickTresh
&& pose == fLastClickedPose) {
fLastClickPt.Set(LONG_MAX, LONG_MAX);
fLastClickedPose = NULL;
fLastClickTime = 0;
if (fTextWidgetToCheck != NULL)
fTextWidgetToCheck->CancelWait();
return true;
@ -7255,7 +7236,6 @@ BPoseView::WasDoubleClick(const BPose* pose, BPoint point)
fLastClickPt = point;
fLastClickedPose = pose;
fLastClickTime = sysTime;
return false;
}

View File

@ -426,7 +426,6 @@ class BPoseView : public BView {
virtual void AdaptToDesktopIntegrationChange(BMessage*);
void SetTextWidgetToCheck(BTextWidget*, BTextWidget* = NULL);
BPoint Origin();
protected:
// view setup
@ -714,7 +713,6 @@ class BPoseView : public BView {
BPose* fAlreadySelectedDropTarget;
BLooper* fSelectionHandler;
BPoint fLastClickPt;
bigtime_t fLastClickTime;
const BPose* fLastClickedPose;
BPoint fLastLeftTop;
BRect fLastExtent;

View File

@ -381,7 +381,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose)
textRect.bottom--;
textView->SetTextRect(textRect);
BPoint origin = view->Origin();
BPoint origin = view->LeftTop();
textRect = view->Bounds();
bool hitBorder = false;