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/events/event.h" | 5 #include "ui/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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 : LocatedEvent(native_event), | 274 : LocatedEvent(native_event), |
275 changed_button_flags_( | 275 changed_button_flags_( |
276 GetChangedMouseButtonFlagsFromNative(native_event)) { | 276 GetChangedMouseButtonFlagsFromNative(native_event)) { |
277 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) | 277 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) |
278 SetClickCount(GetRepeatCount(*this)); | 278 SetClickCount(GetRepeatCount(*this)); |
279 } | 279 } |
280 | 280 |
281 MouseEvent::MouseEvent(EventType type, | 281 MouseEvent::MouseEvent(EventType type, |
282 const gfx::Point& location, | 282 const gfx::Point& location, |
283 const gfx::Point& root_location, | 283 const gfx::Point& root_location, |
284 int flags) | 284 int flags, |
| 285 int changed_button_flags) |
285 : LocatedEvent(type, location, root_location, EventTimeForNow(), flags), | 286 : LocatedEvent(type, location, root_location, EventTimeForNow(), flags), |
286 changed_button_flags_(0) { | 287 changed_button_flags_(changed_button_flags) { |
287 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) | 288 if (this->type() == ET_MOUSE_MOVED && IsAnyButton()) |
288 SetType(ET_MOUSE_DRAGGED); | 289 SetType(ET_MOUSE_DRAGGED); |
289 } | 290 } |
290 | 291 |
291 // static | 292 // static |
292 bool MouseEvent::IsRepeatedClickEvent( | 293 bool MouseEvent::IsRepeatedClickEvent( |
293 const MouseEvent& event1, | 294 const MouseEvent& event1, |
294 const MouseEvent& event2) { | 295 const MouseEvent& event2) { |
295 // These values match the Windows defaults. | 296 // These values match the Windows defaults. |
296 static const int kDoubleClickTimeMS = 500; | 297 static const int kDoubleClickTimeMS = 500; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 658 |
658 ScrollEvent::ScrollEvent(EventType type, | 659 ScrollEvent::ScrollEvent(EventType type, |
659 const gfx::Point& location, | 660 const gfx::Point& location, |
660 base::TimeDelta time_stamp, | 661 base::TimeDelta time_stamp, |
661 int flags, | 662 int flags, |
662 float x_offset, | 663 float x_offset, |
663 float y_offset, | 664 float y_offset, |
664 float x_offset_ordinal, | 665 float x_offset_ordinal, |
665 float y_offset_ordinal, | 666 float y_offset_ordinal, |
666 int finger_count) | 667 int finger_count) |
667 : MouseEvent(type, location, location, flags), | 668 : MouseEvent(type, location, location, flags, 0), |
668 x_offset_(x_offset), | 669 x_offset_(x_offset), |
669 y_offset_(y_offset), | 670 y_offset_(y_offset), |
670 x_offset_ordinal_(x_offset_ordinal), | 671 x_offset_ordinal_(x_offset_ordinal), |
671 y_offset_ordinal_(y_offset_ordinal), | 672 y_offset_ordinal_(y_offset_ordinal), |
672 finger_count_(finger_count) { | 673 finger_count_(finger_count) { |
673 set_time_stamp(time_stamp); | 674 set_time_stamp(time_stamp); |
674 CHECK(IsScrollEvent()); | 675 CHECK(IsScrollEvent()); |
675 } | 676 } |
676 | 677 |
677 void ScrollEvent::Scale(const float factor) { | 678 void ScrollEvent::Scale(const float factor) { |
(...skipping 28 matching lines...) Expand all Loading... |
706 int GestureEvent::GetLowestTouchId() const { | 707 int GestureEvent::GetLowestTouchId() const { |
707 if (touch_ids_bitfield_ == 0) | 708 if (touch_ids_bitfield_ == 0) |
708 return -1; | 709 return -1; |
709 int i = -1; | 710 int i = -1; |
710 // Find the index of the least significant 1 bit | 711 // Find the index of the least significant 1 bit |
711 while (!(1 << ++i & touch_ids_bitfield_)); | 712 while (!(1 << ++i & touch_ids_bitfield_)); |
712 return i; | 713 return i; |
713 } | 714 } |
714 | 715 |
715 } // namespace ui | 716 } // namespace ui |
OLD | NEW |