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/events/event.h" | 5 #include "ui/base/events/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const gfx::Point& location, | 136 const gfx::Point& location, |
137 const gfx::Point& root_location, | 137 const gfx::Point& root_location, |
138 int flags) | 138 int flags) |
139 : Event(type, flags), | 139 : Event(type, flags), |
140 location_(location), | 140 location_(location), |
141 root_location_(root_location), | 141 root_location_(root_location), |
142 valid_system_location_(false), | 142 valid_system_location_(false), |
143 system_location_(0, 0) { | 143 system_location_(0, 0) { |
144 } | 144 } |
145 | 145 |
146 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { | 146 void LocatedEvent::UpdateForRootTransform( |
| 147 const gfx::Transform& root_transform) { |
147 // Transform has to be done at root level. | 148 // Transform has to be done at root level. |
148 DCHECK_EQ(root_location_.x(), location_.x()); | 149 DCHECK_EQ(root_location_.x(), location_.x()); |
149 DCHECK_EQ(root_location_.y(), location_.y()); | 150 DCHECK_EQ(root_location_.y(), location_.y()); |
150 gfx::Point3f p(location_); | 151 gfx::Point3f p(location_); |
151 root_transform.TransformPointReverse(p); | 152 root_transform.TransformPointReverse(p); |
152 root_location_ = location_ = p.AsPoint(); | 153 root_location_ = location_ = p.AsPoint(); |
153 } | 154 } |
154 | 155 |
155 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
156 // MouseEvent | 157 // MouseEvent |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 308 } |
308 | 309 |
309 TouchEvent::~TouchEvent() { | 310 TouchEvent::~TouchEvent() { |
310 } | 311 } |
311 | 312 |
312 void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) { | 313 void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) { |
313 location_ = CalibratePoint(location_, from, to); | 314 location_ = CalibratePoint(location_, from, to); |
314 root_location_ = CalibratePoint(root_location_, from, to); | 315 root_location_ = CalibratePoint(root_location_, from, to); |
315 } | 316 } |
316 | 317 |
317 void TouchEvent::UpdateForRootTransform(const Transform& root_transform) { | 318 void TouchEvent::UpdateForRootTransform(const gfx::Transform& root_transform) { |
318 LocatedEvent::UpdateForRootTransform(root_transform); | 319 LocatedEvent::UpdateForRootTransform(root_transform); |
319 gfx::Point3f scale; | 320 gfx::Point3f scale; |
320 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); | 321 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); |
321 if (scale.x()) | 322 if (scale.x()) |
322 radius_x_ /= scale.x(); | 323 radius_x_ /= scale.x(); |
323 if (scale.y()) | 324 if (scale.y()) |
324 radius_y_ /= scale.y(); | 325 radius_y_ /= scale.y(); |
325 } | 326 } |
326 | 327 |
327 //////////////////////////////////////////////////////////////////////////////// | 328 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 int GestureEvent::GetLowestTouchId() const { | 516 int GestureEvent::GetLowestTouchId() const { |
516 if (touch_ids_bitfield_ == 0) | 517 if (touch_ids_bitfield_ == 0) |
517 return -1; | 518 return -1; |
518 int i = -1; | 519 int i = -1; |
519 // Find the index of the least significant 1 bit | 520 // Find the index of the least significant 1 bit |
520 while (!(1 << ++i & touch_ids_bitfield_)); | 521 while (!(1 << ++i & touch_ids_bitfield_)); |
521 return i; | 522 return i; |
522 } | 523 } |
523 | 524 |
524 } // namespace ui | 525 } // namespace ui |
OLD | NEW |