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/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/keysym.h> | 10 #include <X11/keysym.h> |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 //////////////////////////////////////////////////////////////////////////////// | 509 //////////////////////////////////////////////////////////////////////////////// |
510 // TouchEvent | 510 // TouchEvent |
511 | 511 |
512 TouchEvent::TouchEvent(const base::NativeEvent& native_event) | 512 TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
513 : LocatedEvent(native_event), | 513 : LocatedEvent(native_event), |
514 touch_id_(GetTouchId(native_event)), | 514 touch_id_(GetTouchId(native_event)), |
515 radius_x_(GetTouchRadiusX(native_event)), | 515 radius_x_(GetTouchRadiusX(native_event)), |
516 radius_y_(GetTouchRadiusY(native_event)), | 516 radius_y_(GetTouchRadiusY(native_event)), |
517 rotation_angle_(GetTouchAngle(native_event)), | 517 rotation_angle_(GetTouchAngle(native_event)), |
| 518 tilt_(GetTouchTilt(native_event)), |
518 force_(GetTouchForce(native_event)) { | 519 force_(GetTouchForce(native_event)) { |
519 latency()->AddLatencyNumberWithTimestamp( | 520 latency()->AddLatencyNumberWithTimestamp( |
520 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 521 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
521 0, | 522 0, |
522 0, | 523 0, |
523 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), | 524 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), |
524 1); | 525 1); |
525 | 526 |
526 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 527 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
527 | 528 |
528 if (type() == ET_TOUCH_PRESSED) | 529 if (type() == ET_TOUCH_PRESSED) |
529 IncrementTouchIdRefCount(native_event); | 530 IncrementTouchIdRefCount(native_event); |
530 } | 531 } |
531 | 532 |
532 TouchEvent::TouchEvent(EventType type, | 533 TouchEvent::TouchEvent(EventType type, |
533 const gfx::PointF& location, | 534 const gfx::PointF& location, |
534 int touch_id, | 535 int touch_id, |
535 base::TimeDelta time_stamp) | 536 base::TimeDelta time_stamp) |
536 : LocatedEvent(type, location, location, time_stamp, 0), | 537 : LocatedEvent(type, location, location, time_stamp, 0), |
537 touch_id_(touch_id), | 538 touch_id_(touch_id), |
538 radius_x_(0.0f), | 539 radius_x_(0.0f), |
539 radius_y_(0.0f), | 540 radius_y_(0.0f), |
540 rotation_angle_(0.0f), | 541 rotation_angle_(0.0f), |
| 542 tilt_(0.0f), |
541 force_(0.0f) { | 543 force_(0.0f) { |
542 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 544 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
543 } | 545 } |
544 | 546 |
545 TouchEvent::TouchEvent(EventType type, | 547 TouchEvent::TouchEvent(EventType type, |
546 const gfx::PointF& location, | 548 const gfx::PointF& location, |
547 int flags, | 549 int flags, |
548 int touch_id, | 550 int touch_id, |
549 base::TimeDelta time_stamp, | 551 base::TimeDelta time_stamp, |
550 float radius_x, | 552 float radius_x, |
551 float radius_y, | 553 float radius_y, |
552 float angle, | 554 float angle, |
| 555 float tilt, |
553 float force) | 556 float force) |
554 : LocatedEvent(type, location, location, time_stamp, flags), | 557 : LocatedEvent(type, location, location, time_stamp, flags), |
555 touch_id_(touch_id), | 558 touch_id_(touch_id), |
556 radius_x_(radius_x), | 559 radius_x_(radius_x), |
557 radius_y_(radius_y), | 560 radius_y_(radius_y), |
558 rotation_angle_(angle), | 561 rotation_angle_(angle), |
| 562 tilt_(tilt), |
559 force_(force) { | 563 force_(force) { |
560 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 564 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
561 } | 565 } |
562 | 566 |
563 TouchEvent::~TouchEvent() { | 567 TouchEvent::~TouchEvent() { |
564 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 | 568 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
565 // platform setups the tracking_id to slot mapping. So in dtor here, | 569 // platform setups the tracking_id to slot mapping. So in dtor here, |
566 // if this touch event is a release event, we clear the mapping accordingly. | 570 // if this touch event is a release event, we clear the mapping accordingly. |
567 if (HasNativeEvent()) | 571 if (HasNativeEvent()) |
568 ClearTouchIdIfReleased(native_event()); | 572 ClearTouchIdIfReleased(native_event()); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 gfx::PointF(x, y), | 974 gfx::PointF(x, y), |
971 time_stamp, | 975 time_stamp, |
972 flags | EF_FROM_TOUCH), | 976 flags | EF_FROM_TOUCH), |
973 details_(details) { | 977 details_(details) { |
974 } | 978 } |
975 | 979 |
976 GestureEvent::~GestureEvent() { | 980 GestureEvent::~GestureEvent() { |
977 } | 981 } |
978 | 982 |
979 } // namespace ui | 983 } // namespace ui |
OLD | NEW |