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/event.h" | 5 #include "ui/base/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // LocatedEvent | 93 // LocatedEvent |
94 | 94 |
95 LocatedEvent::~LocatedEvent() { | 95 LocatedEvent::~LocatedEvent() { |
96 } | 96 } |
97 | 97 |
98 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) | 98 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) |
99 : Event(native_event, | 99 : Event(native_event, |
100 EventTypeFromNative(native_event), | 100 EventTypeFromNative(native_event), |
101 EventFlagsFromNative(native_event)), | 101 EventFlagsFromNative(native_event)), |
102 location_(EventLocationFromNative(native_event)), | 102 location_(EventLocationFromNative(native_event)), |
103 root_location_(location_) { | 103 root_location_(location_), |
| 104 valid_system_location_(true), |
| 105 system_location_(ui::EventSystemLocationFromNative(native_event)) { |
104 } | 106 } |
105 | 107 |
106 LocatedEvent::LocatedEvent(EventType type, | 108 LocatedEvent::LocatedEvent(EventType type, |
107 const gfx::Point& location, | 109 const gfx::Point& location, |
108 const gfx::Point& root_location, | 110 const gfx::Point& root_location, |
109 int flags) | 111 int flags) |
110 : Event(type, flags), | 112 : Event(type, flags), |
111 location_(location), | 113 location_(location), |
112 root_location_(root_location) { | 114 root_location_(root_location), |
| 115 valid_system_location_(false), |
| 116 system_location_(0, 0) { |
113 } | 117 } |
114 | 118 |
115 LocatedEvent::LocatedEvent(const LocatedEvent& model) | 119 LocatedEvent::LocatedEvent(const LocatedEvent& model) |
116 : Event(model), | 120 : Event(model), |
117 location_(model.location_), | 121 location_(model.location_), |
118 root_location_(model.root_location_) { | 122 root_location_(model.root_location_), |
| 123 valid_system_location_(model.valid_system_location_), |
| 124 system_location_(model.system_location_) { |
119 } | 125 } |
120 | 126 |
121 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { | 127 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { |
122 // Transform has to be done at root level. | 128 // Transform has to be done at root level. |
123 DCHECK_EQ(root_location_.x(), location_.x()); | 129 DCHECK_EQ(root_location_.x(), location_.x()); |
124 DCHECK_EQ(root_location_.y(), location_.y()); | 130 DCHECK_EQ(root_location_.y(), location_.y()); |
125 gfx::Point3f p(location_); | 131 gfx::Point3f p(location_); |
126 root_transform.TransformPointReverse(p); | 132 root_transform.TransformPointReverse(p); |
127 root_location_ = location_ = p.AsPoint(); | 133 root_location_ = location_ = p.AsPoint(); |
128 } | 134 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 int GestureEvent::GetLowestTouchId() const { | 472 int GestureEvent::GetLowestTouchId() const { |
467 if (touch_ids_bitfield_ == 0) | 473 if (touch_ids_bitfield_ == 0) |
468 return -1; | 474 return -1; |
469 int i = -1; | 475 int i = -1; |
470 // Find the index of the least significant 1 bit | 476 // Find the index of the least significant 1 bit |
471 while (!(1 << ++i & touch_ids_bitfield_)); | 477 while (!(1 << ++i & touch_ids_bitfield_)); |
472 return i; | 478 return i; |
473 } | 479 } |
474 | 480 |
475 } // namespace ui | 481 } // namespace ui |
OLD | NEW |