| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 //////////////////////////////////////////////////////////////////////////////// | 516 //////////////////////////////////////////////////////////////////////////////// |
| 517 // TouchEvent | 517 // TouchEvent |
| 518 | 518 |
| 519 TouchEvent::TouchEvent(const base::NativeEvent& native_event) | 519 TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
| 520 : LocatedEvent(native_event), | 520 : LocatedEvent(native_event), |
| 521 touch_id_(GetTouchId(native_event)), | 521 touch_id_(GetTouchId(native_event)), |
| 522 unique_event_id_(get_next_touch_event_id()), | 522 unique_event_id_(get_next_touch_event_id()), |
| 523 radius_x_(GetTouchRadiusX(native_event)), | 523 radius_x_(GetTouchRadiusX(native_event)), |
| 524 radius_y_(GetTouchRadiusY(native_event)), | 524 radius_y_(GetTouchRadiusY(native_event)), |
| 525 rotation_angle_(GetTouchAngle(native_event)), | 525 rotation_angle_(GetTouchAngle(native_event)), |
| 526 force_(GetTouchForce(native_event)) { | 526 force_(GetTouchForce(native_event)), |
| 527 may_cause_scrolling_(false) { |
| 527 latency()->AddLatencyNumberWithTimestamp( | 528 latency()->AddLatencyNumberWithTimestamp( |
| 528 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 529 INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 529 0, | 530 0, |
| 530 0, | 531 0, |
| 531 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), | 532 base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), |
| 532 1); | 533 1); |
| 533 | 534 |
| 534 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 535 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 535 | 536 |
| 536 if (type() == ET_TOUCH_PRESSED) | 537 if (type() == ET_TOUCH_PRESSED) |
| 537 IncrementTouchIdRefCount(native_event); | 538 IncrementTouchIdRefCount(native_event); |
| 538 } | 539 } |
| 539 | 540 |
| 540 TouchEvent::TouchEvent(EventType type, | 541 TouchEvent::TouchEvent(EventType type, |
| 541 const gfx::PointF& location, | 542 const gfx::PointF& location, |
| 542 int touch_id, | 543 int touch_id, |
| 543 base::TimeDelta time_stamp) | 544 base::TimeDelta time_stamp) |
| 544 : LocatedEvent(type, location, location, time_stamp, 0), | 545 : LocatedEvent(type, location, location, time_stamp, 0), |
| 545 touch_id_(touch_id), | 546 touch_id_(touch_id), |
| 546 unique_event_id_(get_next_touch_event_id()), | 547 unique_event_id_(get_next_touch_event_id()), |
| 547 radius_x_(0.0f), | 548 radius_x_(0.0f), |
| 548 radius_y_(0.0f), | 549 radius_y_(0.0f), |
| 549 rotation_angle_(0.0f), | 550 rotation_angle_(0.0f), |
| 550 force_(0.0f) { | 551 force_(0.0f), |
| 552 may_cause_scrolling_(false) { |
| 551 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 553 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 552 } | 554 } |
| 553 | 555 |
| 554 TouchEvent::TouchEvent(EventType type, | 556 TouchEvent::TouchEvent(EventType type, |
| 555 const gfx::PointF& location, | 557 const gfx::PointF& location, |
| 556 int flags, | 558 int flags, |
| 557 int touch_id, | 559 int touch_id, |
| 558 base::TimeDelta time_stamp, | 560 base::TimeDelta time_stamp, |
| 559 float radius_x, | 561 float radius_x, |
| 560 float radius_y, | 562 float radius_y, |
| 561 float angle, | 563 float angle, |
| 562 float force) | 564 float force) |
| 563 : LocatedEvent(type, location, location, time_stamp, flags), | 565 : LocatedEvent(type, location, location, time_stamp, flags), |
| 564 touch_id_(touch_id), | 566 touch_id_(touch_id), |
| 565 unique_event_id_(get_next_touch_event_id()), | 567 unique_event_id_(get_next_touch_event_id()), |
| 566 radius_x_(radius_x), | 568 radius_x_(radius_x), |
| 567 radius_y_(radius_y), | 569 radius_y_(radius_y), |
| 568 rotation_angle_(angle), | 570 rotation_angle_(angle), |
| 569 force_(force) { | 571 force_(force), |
| 572 may_cause_scrolling_(false) { |
| 570 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 573 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
| 571 } | 574 } |
| 572 | 575 |
| 573 TouchEvent::~TouchEvent() { | 576 TouchEvent::~TouchEvent() { |
| 574 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 | 577 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
| 575 // platform setups the tracking_id to slot mapping. So in dtor here, | 578 // platform setups the tracking_id to slot mapping. So in dtor here, |
| 576 // if this touch event is a release event, we clear the mapping accordingly. | 579 // if this touch event is a release event, we clear the mapping accordingly. |
| 577 if (HasNativeEvent()) | 580 if (HasNativeEvent()) |
| 578 ClearTouchIdIfReleased(native_event()); | 581 ClearTouchIdIfReleased(native_event()); |
| 579 } | 582 } |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 gfx::PointF(x, y), | 996 gfx::PointF(x, y), |
| 994 time_stamp, | 997 time_stamp, |
| 995 flags | EF_FROM_TOUCH), | 998 flags | EF_FROM_TOUCH), |
| 996 details_(details) { | 999 details_(details) { |
| 997 } | 1000 } |
| 998 | 1001 |
| 999 GestureEvent::~GestureEvent() { | 1002 GestureEvent::~GestureEvent() { |
| 1000 } | 1003 } |
| 1001 | 1004 |
| 1002 } // namespace ui | 1005 } // namespace ui |
| OLD | NEW |