| 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/keysym.h> | 9 #include <X11/keysym.h> |
| 10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 // TouchEvent | 519 // TouchEvent |
| 520 | 520 |
| 521 TouchEvent::TouchEvent(const base::NativeEvent& native_event) | 521 TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
| 522 : LocatedEvent(native_event), | 522 : LocatedEvent(native_event), |
| 523 touch_id_(GetTouchId(native_event)), | 523 touch_id_(GetTouchId(native_event)), |
| 524 unique_event_id_(get_next_touch_event_id()), | 524 unique_event_id_(get_next_touch_event_id()), |
| 525 radius_x_(GetTouchRadiusX(native_event)), | 525 radius_x_(GetTouchRadiusX(native_event)), |
| 526 radius_y_(GetTouchRadiusY(native_event)), | 526 radius_y_(GetTouchRadiusY(native_event)), |
| 527 rotation_angle_(GetTouchAngle(native_event)), | 527 rotation_angle_(GetTouchAngle(native_event)), |
| 528 force_(GetTouchForce(native_event)), | 528 force_(GetTouchForce(native_event)), |
| 529 tilt_(GetTouchTilt(native_event)), |
| 530 tiltDirection_(GetTouchTiltDirection(native_event)), |
| 529 may_cause_scrolling_(false) { | 531 may_cause_scrolling_(false) { |
| 530 latency()->AddLatencyNumberWithTimestamp( | 532 latency()->AddLatencyNumberWithTimestamp( |
| 531 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 533 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 532 0, | 534 0, |
| 533 0, | 535 0, |
| 534 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), | 536 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), |
| 535 1); | 537 1); |
| 536 | 538 |
| 537 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 539 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 538 fixRotationAngle(); | 540 fixRotationAngle(); |
| 539 | 541 |
| 540 if (type() == ET_TOUCH_PRESSED) | 542 if (type() == ET_TOUCH_PRESSED) |
| 541 IncrementTouchIdRefCount(native_event); | 543 IncrementTouchIdRefCount(native_event); |
| 542 } | 544 } |
| 543 | 545 |
| 544 TouchEvent::TouchEvent(EventType type, | 546 TouchEvent::TouchEvent(EventType type, |
| 545 const gfx::PointF& location, | 547 const gfx::PointF& location, |
| 546 int touch_id, | 548 int touch_id, |
| 547 base::TimeDelta time_stamp) | 549 base::TimeDelta time_stamp) |
| 548 : LocatedEvent(type, location, location, time_stamp, 0), | 550 : LocatedEvent(type, location, location, time_stamp, 0), |
| 549 touch_id_(touch_id), | 551 touch_id_(touch_id), |
| 550 unique_event_id_(get_next_touch_event_id()), | 552 unique_event_id_(get_next_touch_event_id()), |
| 551 radius_x_(0.0f), | 553 radius_x_(0.0f), |
| 552 radius_y_(0.0f), | 554 radius_y_(0.0f), |
| 553 rotation_angle_(0.0f), | 555 rotation_angle_(0.0f), |
| 554 force_(0.0f), | 556 force_(0.0f), |
| 557 tilt_(std::numeric_limits<float>::quiet_NaN()), |
| 558 tiltDirection_(std::numeric_limits<float>::quiet_NaN()), |
| 555 may_cause_scrolling_(false) { | 559 may_cause_scrolling_(false) { |
| 556 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 560 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 557 } | 561 } |
| 558 | 562 |
| 559 TouchEvent::TouchEvent(EventType type, | 563 TouchEvent::TouchEvent(EventType type, |
| 560 const gfx::PointF& location, | 564 const gfx::PointF& location, |
| 561 int flags, | 565 int flags, |
| 562 int touch_id, | 566 int touch_id, |
| 563 base::TimeDelta time_stamp, | 567 base::TimeDelta time_stamp, |
| 564 float radius_x, | 568 float radius_x, |
| 565 float radius_y, | 569 float radius_y, |
| 566 float angle, | 570 float angle, |
| 567 float force) | 571 float force, |
| 572 float tilt, |
| 573 float tiltDirection) |
| 568 : LocatedEvent(type, location, location, time_stamp, flags), | 574 : LocatedEvent(type, location, location, time_stamp, flags), |
| 569 touch_id_(touch_id), | 575 touch_id_(touch_id), |
| 570 unique_event_id_(get_next_touch_event_id()), | 576 unique_event_id_(get_next_touch_event_id()), |
| 571 radius_x_(radius_x), | 577 radius_x_(radius_x), |
| 572 radius_y_(radius_y), | 578 radius_y_(radius_y), |
| 573 rotation_angle_(angle), | 579 rotation_angle_(angle), |
| 574 force_(force), | 580 force_(force), |
| 581 tilt_(tilt), |
| 582 tiltDirection_(tiltDirection), |
| 575 may_cause_scrolling_(false) { | 583 may_cause_scrolling_(false) { |
| 576 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 584 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 577 fixRotationAngle(); | 585 fixRotationAngle(); |
| 578 } | 586 } |
| 579 | 587 |
| 580 TouchEvent::~TouchEvent() { | 588 TouchEvent::~TouchEvent() { |
| 581 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 | 589 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
| 582 // platform setups the tracking_id to slot mapping. So in dtor here, | 590 // platform setups the tracking_id to slot mapping. So in dtor here, |
| 583 // if this touch event is a release event, we clear the mapping accordingly. | 591 // if this touch event is a release event, we clear the mapping accordingly. |
| 584 if (HasNativeEvent()) | 592 if (HasNativeEvent()) |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 gfx::PointF(x, y), | 981 gfx::PointF(x, y), |
| 974 time_stamp, | 982 time_stamp, |
| 975 flags | EF_FROM_TOUCH), | 983 flags | EF_FROM_TOUCH), |
| 976 details_(details) { | 984 details_(details) { |
| 977 } | 985 } |
| 978 | 986 |
| 979 GestureEvent::~GestureEvent() { | 987 GestureEvent::~GestureEvent() { |
| 980 } | 988 } |
| 981 | 989 |
| 982 } // namespace ui | 990 } // namespace ui |
| OLD | NEW |