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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 #if defined(OS_WIN) | 499 #if defined(OS_WIN) |
500 // This value matches windows WHEEL_DELTA. | 500 // This value matches windows WHEEL_DELTA. |
501 // static | 501 // static |
502 const int MouseWheelEvent::kWheelDelta = 120; | 502 const int MouseWheelEvent::kWheelDelta = 120; |
503 #else | 503 #else |
504 // This value matches GTK+ wheel scroll amount. | 504 // This value matches GTK+ wheel scroll amount. |
505 const int MouseWheelEvent::kWheelDelta = 53; | 505 const int MouseWheelEvent::kWheelDelta = 53; |
506 #endif | 506 #endif |
507 | 507 |
508 void MouseWheelEvent::UpdateForRootTransform( | |
509 const gfx::Transform& inverted_root_transform) { | |
510 LocatedEvent::UpdateForRootTransform(inverted_root_transform); | |
511 gfx::DecomposedTransform decomp; | |
512 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); | |
513 DCHECK(success); | |
514 if (decomp.scale[0]) { | |
515 offset_.set_x( | |
516 gfx::ToRoundedInt(SkMScalarToFloat(offset_.x() * decomp.scale[0]))); | |
517 } | |
518 if (decomp.scale[1]) { | |
519 offset_.set_y( | |
520 gfx::ToRoundedInt(SkMScalarToFloat(offset_.y() * decomp.scale[1]))); | |
521 } | |
522 } | |
523 | |
524 //////////////////////////////////////////////////////////////////////////////// | 508 //////////////////////////////////////////////////////////////////////////////// |
525 // TouchEvent | 509 // TouchEvent |
526 | 510 |
527 TouchEvent::TouchEvent(const base::NativeEvent& native_event) | 511 TouchEvent::TouchEvent(const base::NativeEvent& native_event) |
528 : LocatedEvent(native_event), | 512 : LocatedEvent(native_event), |
529 touch_id_(GetTouchId(native_event)), | 513 touch_id_(GetTouchId(native_event)), |
530 unique_event_id_(get_next_touch_event_id()), | 514 unique_event_id_(get_next_touch_event_id()), |
531 radius_x_(GetTouchRadiusX(native_event)), | 515 radius_x_(GetTouchRadiusX(native_event)), |
532 radius_y_(GetTouchRadiusY(native_event)), | 516 radius_y_(GetTouchRadiusY(native_event)), |
533 rotation_angle_(GetTouchAngle(native_event)), | 517 rotation_angle_(GetTouchAngle(native_event)), |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 gfx::PointF(x, y), | 984 gfx::PointF(x, y), |
1001 time_stamp, | 985 time_stamp, |
1002 flags | EF_FROM_TOUCH), | 986 flags | EF_FROM_TOUCH), |
1003 details_(details) { | 987 details_(details) { |
1004 } | 988 } |
1005 | 989 |
1006 GestureEvent::~GestureEvent() { | 990 GestureEvent::~GestureEvent() { |
1007 } | 991 } |
1008 | 992 |
1009 } // namespace ui | 993 } // namespace ui |
OLD | NEW |