Chromium Code Reviews| Index: ui/events/event.cc |
| diff --git a/ui/events/event.cc b/ui/events/event.cc |
| index df38f38365ace7a3d8adbd89ea72bf7d493385ae..51379402fd8217b5e6d8c006e92195a8361732a6 100644 |
| --- a/ui/events/event.cc |
| +++ b/ui/events/event.cc |
| @@ -317,23 +317,46 @@ bool MouseEvent::IsRepeatedClickEvent( |
| int MouseEvent::GetRepeatCount(const MouseEvent& event) { |
| int click_count = 1; |
| if (last_click_event_) { |
| - if (event.type() == ui::ET_MOUSE_RELEASED) |
| - return last_click_event_->GetClickCount(); |
| - if (IsX11SendEventTrue(event.native_event())) |
| + if (event.type() == ui::ET_MOUSE_RELEASED) { |
| + if (event.changed_button_flags() == |
| + last_click_event_->changed_button_flags()) { |
| + last_click_complete_ = true; |
| + return last_click_event_->GetClickCount(); |
| + } else { |
| + // If last_click_event_ has changed since this button was pressed |
| + // return a click count of 1. |
| + return click_count; |
| + } |
| + } |
| + if (event.time_stamp() != last_click_event_->time_stamp()) |
| + last_click_complete_ = true; |
| + if (!last_click_complete_ || |
| + IsX11SendEventTrue(event.native_event())) { |
| click_count = last_click_event_->GetClickCount(); |
| - else if (IsRepeatedClickEvent(*last_click_event_, event)) |
| + } else if (IsRepeatedClickEvent(*last_click_event_, event)) { |
| click_count = last_click_event_->GetClickCount() + 1; |
| + } |
| delete last_click_event_; |
| } |
| last_click_event_ = new MouseEvent(event); |
| + last_click_complete_ = false; |
|
sky
2014/07/18 22:42:51
Do we need both last_click_complete_ and last_clic
flackr
2014/07/19 12:55:11
It's marked complete when another pressed event sh
|
| if (click_count > 3) |
| click_count = 3; |
| last_click_event_->SetClickCount(click_count); |
| return click_count; |
| } |
| +void MouseEvent::ResetLastClickForTest() { |
| + if (last_click_event_) { |
| + delete last_click_event_; |
| + last_click_event_ = NULL; |
| + last_click_complete_ = false; |
| + } |
| +} |
| + |
| // static |
| MouseEvent* MouseEvent::last_click_event_ = NULL; |
| +bool MouseEvent::last_click_complete_ = false; |
| int MouseEvent::GetClickCount() const { |
| if (type() != ET_MOUSE_PRESSED && type() != ET_MOUSE_RELEASED) |