Tracker: Do not start edit while dragging, fixes #20176.
We have to check for dragging in Pulse(), it's too late to check this by the time we have gotten to StartEdit(). A bit of additional cleanup including some related comments. Change-Id: Id292d73593d12028e7368c50dac0869c4a7df94b Reviewed-on: https://review.haiku-os.org/c/haiku/+/11439 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]> Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
@@ -970,9 +970,8 @@ BPoseView::Pulse()
|
||||
}
|
||||
}
|
||||
|
||||
// do we have a TextWidget waiting for expiracy of its double-click
|
||||
// check?
|
||||
if (fTextWidgetToCheck != NULL)
|
||||
// Do we have a TextWidget waiting for its double-click check to expire?
|
||||
if (fTextWidgetToCheck != NULL && !IsDragging())
|
||||
fTextWidgetToCheck->CheckExpiration();
|
||||
}
|
||||
|
||||
|
||||
@@ -244,21 +244,19 @@ BTextWidget::CalcClickRect(BPoint poseLoc, const BColumn* column, const BPoseVie
|
||||
void
|
||||
BTextWidget::CheckExpiration()
|
||||
{
|
||||
if (IsEditable() && fParams.pose->IsSelected() && fLastClickedTime) {
|
||||
if (fLastClickedTime > 0 && IsEditable() && fParams.pose->IsSelected()) {
|
||||
bigtime_t doubleClickSpeed;
|
||||
get_click_speed(&doubleClickSpeed);
|
||||
|
||||
bigtime_t delta = system_time() - fLastClickedTime;
|
||||
|
||||
if (delta > doubleClickSpeed) {
|
||||
// at least 'doubleClickSpeed' microseconds ellapsed and no click
|
||||
// was registered since.
|
||||
// at least 'doubleClickSpeed' microseconds elapsed with no click
|
||||
fLastClickedTime = 0;
|
||||
StartEdit(fParams.bounds, fParams.poseView, fParams.pose);
|
||||
}
|
||||
} else {
|
||||
fLastClickedTime = 0;
|
||||
fParams.poseView->SetTextWidgetToCheck(NULL);
|
||||
CancelWait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,10 +443,6 @@ BTextWidget::StartEdit(BRect bounds, BPoseView* view, BPose* pose)
|
||||
if (!IsEditable() || IsActive())
|
||||
return;
|
||||
|
||||
// do not start edit while dragging
|
||||
if (view->IsDragging())
|
||||
return;
|
||||
|
||||
view->SetActiveTextWidget(this);
|
||||
|
||||
// The initial text color has to be set differently on Desktop
|
||||
|
||||
Reference in New Issue
Block a user