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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 f &= ~EF_IS_DOUBLE_CLICK; | 217 f &= ~EF_IS_DOUBLE_CLICK; |
218 f |= EF_IS_TRIPLE_CLICK; | 218 f |= EF_IS_TRIPLE_CLICK; |
219 break; | 219 break; |
220 } | 220 } |
221 set_flags(f); | 221 set_flags(f); |
222 } | 222 } |
223 | 223 |
224 MouseEvent::MouseEvent(const MouseEvent& model) : LocatedEvent(model) { | 224 MouseEvent::MouseEvent(const MouseEvent& model) : LocatedEvent(model) { |
225 } | 225 } |
226 | 226 |
227 TouchEventImpl::TouchEventImpl(const base::NativeEvent& native_event) | 227 TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
228 : LocatedEvent(native_event), | 228 : LocatedEvent(native_event), |
229 touch_id_(ui::GetTouchId(native_event)), | 229 touch_id_(ui::GetTouchId(native_event)), |
230 radius_x_(GetTouchRadiusX(native_event)), | 230 radius_x_(GetTouchRadiusX(native_event)), |
231 radius_y_(GetTouchRadiusY(native_event)), | 231 radius_y_(GetTouchRadiusY(native_event)), |
232 rotation_angle_(GetTouchAngle(native_event)), | 232 rotation_angle_(GetTouchAngle(native_event)), |
233 force_(GetTouchForce(native_event)) { | 233 force_(GetTouchForce(native_event)) { |
234 } | 234 } |
235 | 235 |
236 TouchEventImpl::TouchEventImpl(EventType type, | 236 TouchEvent::TouchEvent(EventType type, |
237 const gfx::Point& location, | 237 const gfx::Point& location, |
238 int touch_id, | 238 int touch_id, |
239 base::TimeDelta time_stamp) | 239 base::TimeDelta time_stamp) |
240 : LocatedEvent(type, location, location, 0), | 240 : LocatedEvent(type, location, location, 0), |
241 touch_id_(touch_id), | 241 touch_id_(touch_id), |
242 radius_x_(0.0f), | 242 radius_x_(0.0f), |
243 radius_y_(0.0f), | 243 radius_y_(0.0f), |
244 rotation_angle_(0.0f), | 244 rotation_angle_(0.0f), |
245 force_(0.0f) { | 245 force_(0.0f) { |
246 set_time_stamp(time_stamp); | 246 set_time_stamp(time_stamp); |
247 } | 247 } |
248 | 248 |
249 TouchEventImpl::~TouchEventImpl() { | 249 TouchEvent::~TouchEvent() { |
250 } | 250 } |
251 | 251 |
252 void TouchEventImpl::UpdateForRootTransform(const Transform& root_transform) { | 252 void TouchEvent::UpdateForRootTransform(const Transform& root_transform) { |
253 LocatedEvent::UpdateForRootTransform(root_transform); | 253 LocatedEvent::UpdateForRootTransform(root_transform); |
254 gfx::Point3f scale; | 254 gfx::Point3f scale; |
255 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); | 255 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); |
256 if (scale.x()) | 256 if (scale.x()) |
257 radius_x_ /= scale.x(); | 257 radius_x_ /= scale.x(); |
258 if (scale.y()) | 258 if (scale.y()) |
259 radius_y_ /= scale.y(); | 259 radius_y_ /= scale.y(); |
260 } | 260 } |
261 | 261 |
262 EventType TouchEventImpl::GetEventType() const { | |
263 return type(); | |
264 } | |
265 | |
266 gfx::Point TouchEventImpl::GetLocation() const { | |
267 return location(); | |
268 } | |
269 | |
270 int TouchEventImpl::GetTouchId() const { | |
271 return touch_id_; | |
272 } | |
273 | |
274 int TouchEventImpl::GetEventFlags() const { | |
275 return flags(); | |
276 } | |
277 | |
278 base::TimeDelta TouchEventImpl::GetTimestamp() const { | |
279 return time_stamp(); | |
280 } | |
281 | |
282 float TouchEventImpl::RadiusX() const { | |
283 return radius_x_; | |
284 } | |
285 | |
286 float TouchEventImpl::RadiusY() const { | |
287 return radius_y_; | |
288 } | |
289 | |
290 float TouchEventImpl::RotationAngle() const { | |
291 return rotation_angle_; | |
292 } | |
293 | |
294 float TouchEventImpl::Force() const { | |
295 return force_; | |
296 } | |
297 | |
298 KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) | 262 KeyEvent::KeyEvent(const base::NativeEvent& native_event, bool is_char) |
299 : Event(native_event, | 263 : Event(native_event, |
300 EventTypeFromNative(native_event), | 264 EventTypeFromNative(native_event), |
301 EventFlagsFromNative(native_event)), | 265 EventFlagsFromNative(native_event)), |
302 key_code_(KeyboardCodeFromNative(native_event)), | 266 key_code_(KeyboardCodeFromNative(native_event)), |
303 is_char_(is_char), | 267 is_char_(is_char), |
304 character_(0), | 268 character_(0), |
305 unmodified_character_(0) { | 269 unmodified_character_(0) { |
306 } | 270 } |
307 | 271 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 int GestureEventImpl::GetLowestTouchId() const { | 392 int GestureEventImpl::GetLowestTouchId() const { |
429 if (touch_ids_bitfield_ == 0) | 393 if (touch_ids_bitfield_ == 0) |
430 return -1; | 394 return -1; |
431 int i = -1; | 395 int i = -1; |
432 // Find the index of the least significant 1 bit | 396 // Find the index of the least significant 1 bit |
433 while (!(1 << ++i & touch_ids_bitfield_)); | 397 while (!(1 << ++i & touch_ids_bitfield_)); |
434 return i; | 398 return i; |
435 } | 399 } |
436 | 400 |
437 } // namespace ui | 401 } // namespace ui |
OLD | NEW |