| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 system_location_(0, 0) { | 267 system_location_(0, 0) { |
| 268 } | 268 } |
| 269 | 269 |
| 270 void LocatedEvent::UpdateForRootTransform( | 270 void LocatedEvent::UpdateForRootTransform( |
| 271 const gfx::Transform& root_transform) { | 271 const gfx::Transform& root_transform) { |
| 272 // Transform has to be done at root level. | 272 // Transform has to be done at root level. |
| 273 gfx::Point3F p(location_); | 273 gfx::Point3F p(location_); |
| 274 root_transform.TransformPointReverse(p); | 274 root_transform.TransformPointReverse(p); |
| 275 // TODO(oshima): Translating a point using reversed matrix can | 275 // TODO(oshima): Translating a point using reversed matrix can |
| 276 // results in small error like 0 -> -0.01, whose floored value | 276 // results in small error like 0 -> -0.01, whose floored value |
| 277 // is -1 instead of 0. Investigate the best way to handle this, | 277 // is -1 instead of 0. crbug.com/222483. |
| 278 // instead of just rounding it. | |
| 279 root_location_ = location_ = gfx::ToFlooredPoint(p.AsPointF()); | 278 root_location_ = location_ = gfx::ToFlooredPoint(p.AsPointF()); |
| 280 } | 279 } |
| 281 | 280 |
| 282 //////////////////////////////////////////////////////////////////////////////// | 281 //////////////////////////////////////////////////////////////////////////////// |
| 283 // MouseEvent | 282 // MouseEvent |
| 284 | 283 |
| 285 MouseEvent::MouseEvent(const base::NativeEvent& native_event) | 284 MouseEvent::MouseEvent(const base::NativeEvent& native_event) |
| 286 : LocatedEvent(native_event), | 285 : LocatedEvent(native_event), |
| 287 changed_button_flags_( | 286 changed_button_flags_( |
| 288 GetChangedMouseButtonFlagsFromNative(native_event)) { | 287 GetChangedMouseButtonFlagsFromNative(native_event)) { |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 int GestureEvent::GetLowestTouchId() const { | 729 int GestureEvent::GetLowestTouchId() const { |
| 731 if (touch_ids_bitfield_ == 0) | 730 if (touch_ids_bitfield_ == 0) |
| 732 return -1; | 731 return -1; |
| 733 int i = -1; | 732 int i = -1; |
| 734 // Find the index of the least significant 1 bit | 733 // Find the index of the least significant 1 bit |
| 735 while (!(1 << ++i & touch_ids_bitfield_)); | 734 while (!(1 << ++i & touch_ids_bitfield_)); |
| 736 return i; | 735 return i; |
| 737 } | 736 } |
| 738 | 737 |
| 739 } // namespace ui | 738 } // namespace ui |
| OLD | NEW |