* Reworked my fix for #3617. We now check again for a double click if the pose

was not freshly selected.
+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32660 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner
2009-08-24 19:15:12 +00:00
parent a632bfec28
commit ea1a27d61a
+41 -4
View File
@@ -213,17 +213,54 @@ BTextWidget::CalcClickRect(BPoint poseLoc, const BColumn *column,
void void
BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint) BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint)
{ {
// start editing if the duration between the pose selection time and // Start editing without delay if the pose was selected recently and this
// the click on the widget is bigger than the doubleclick threshold. // click is not the second click of a doubleclick.
// If the pose has been selected a long time ago, check again
// for a double click (inducing a delay).
// TODO: re-enable modifiers, one should be enough
if (IsEditable() && pose->IsSelected()) { if (IsEditable() && pose->IsSelected()) {
bigtime_t delta = system_time() - pose->SelectionTime(); bigtime_t delta = system_time() - pose->SelectionTime();
bigtime_t doubleClickSpeed; bigtime_t doubleClickSpeed;
get_click_speed(&doubleClickSpeed); get_click_speed(&doubleClickSpeed);
bigtime_t oldClickSpeed = 2 * doubleClickSpeed;
// TODO: modifiers // freshly selected and not a double click
if (delta > doubleClickSpeed) if (delta > doubleClickSpeed && delta < oldClickSpeed) {
StartEdit(bounds, view, pose); StartEdit(bounds, view, pose);
return;
}
// TODO: reimplement asynchronous
// selected a longer time ago, redo a double click detection
if (delta > oldClickSpeed) {
// check for double click
bigtime_t doubleClickTime = system_time() + doubleClickSpeed;
while (system_time() < doubleClickTime) {
// loop for double-click time and watch the mouse and keyboard
BPoint point;
uint32 buttons;
view->GetMouse(&point, &buttons, false);
// double click
if (buttons)
return;
// mouse moved too far
if (!bounds.Contains(point))
return;
//if (modifiers() & (B_SHIFT_KEY | B_COMMAND_KEY
// | B_CONTROL_KEY | B_MENU_KEY))
// // watch the keyboard (ignoring standard locking keys)
// break;
snooze(10000);
}
StartEdit(bounds, view, pose);
}
} }
} }