OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/events/event.h" | 5 #include "ui/base/events/event.h" |
6 | 6 |
7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 CASE_TYPE(ET_SCROLL_FLING_CANCEL); | 97 CASE_TYPE(ET_SCROLL_FLING_CANCEL); |
98 case ui::ET_LAST: NOTREACHED(); return std::string(); | 98 case ui::ET_LAST: NOTREACHED(); return std::string(); |
99 // Don't include default, so that we get an error when new type is added. | 99 // Don't include default, so that we get an error when new type is added. |
100 } | 100 } |
101 #undef CASE_TYPE | 101 #undef CASE_TYPE |
102 | 102 |
103 NOTREACHED(); | 103 NOTREACHED(); |
104 return std::string(); | 104 return std::string(); |
105 } | 105 } |
106 | 106 |
| 107 bool IsX11SendEventTrue(const base::NativeEvent& event) { |
| 108 #if defined(USE_X11) |
| 109 if (event && event->xany.send_event) |
| 110 return true; |
| 111 #endif |
| 112 return false; |
| 113 } |
| 114 |
107 } // namespace | 115 } // namespace |
108 | 116 |
109 namespace ui { | 117 namespace ui { |
110 | 118 |
111 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
112 // Event | 120 // Event |
113 | 121 |
114 Event::~Event() { | 122 Event::~Event() { |
115 #if defined(USE_X11) | 123 #if defined(USE_X11) |
116 if (delete_native_event_) | 124 if (delete_native_event_) |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 if (abs(event2.y() - event1.y()) > kDoubleClickHeight / 2) | 318 if (abs(event2.y() - event1.y()) > kDoubleClickHeight / 2) |
311 return false; | 319 return false; |
312 | 320 |
313 return true; | 321 return true; |
314 } | 322 } |
315 | 323 |
316 // static | 324 // static |
317 int MouseEvent::GetRepeatCount(const MouseEvent& event) { | 325 int MouseEvent::GetRepeatCount(const MouseEvent& event) { |
318 int click_count = 1; | 326 int click_count = 1; |
319 if (last_click_event_) { | 327 if (last_click_event_) { |
320 if (IsRepeatedClickEvent(*last_click_event_, event)) | 328 if (IsX11SendEventTrue(event.native_event())) |
| 329 click_count = last_click_event_->GetClickCount(); |
| 330 else if (IsRepeatedClickEvent(*last_click_event_, event)) |
321 click_count = last_click_event_->GetClickCount() + 1; | 331 click_count = last_click_event_->GetClickCount() + 1; |
322 delete last_click_event_; | 332 delete last_click_event_; |
323 } | 333 } |
324 last_click_event_ = new MouseEvent(event); | 334 last_click_event_ = new MouseEvent(event); |
325 if (click_count > 3) | 335 if (click_count > 3) |
326 click_count = 3; | 336 click_count = 3; |
327 last_click_event_->SetClickCount(click_count); | 337 last_click_event_->SetClickCount(click_count); |
328 return click_count; | 338 return click_count; |
329 } | 339 } |
330 | 340 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 int GestureEvent::GetLowestTouchId() const { | 675 int GestureEvent::GetLowestTouchId() const { |
666 if (touch_ids_bitfield_ == 0) | 676 if (touch_ids_bitfield_ == 0) |
667 return -1; | 677 return -1; |
668 int i = -1; | 678 int i = -1; |
669 // Find the index of the least significant 1 bit | 679 // Find the index of the least significant 1 bit |
670 while (!(1 << ++i & touch_ids_bitfield_)); | 680 while (!(1 << ++i & touch_ids_bitfield_)); |
671 return i; | 681 return i; |
672 } | 682 } |
673 | 683 |
674 } // namespace ui | 684 } // namespace ui |
OLD | NEW |