| 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 #endif | 10 #endif |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 493 } |
| 494 | 494 |
| 495 TouchEvent::~TouchEvent() { | 495 TouchEvent::~TouchEvent() { |
| 496 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 | 496 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
| 497 // platform setups the tracking_id to slot mapping. So in dtor here, | 497 // platform setups the tracking_id to slot mapping. So in dtor here, |
| 498 // if this touch event is a release event, we clear the mapping accordingly. | 498 // if this touch event is a release event, we clear the mapping accordingly. |
| 499 if (HasNativeEvent()) | 499 if (HasNativeEvent()) |
| 500 ClearTouchIdIfReleased(native_event()); | 500 ClearTouchIdIfReleased(native_event()); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void TouchEvent::Relocate(const gfx::Point& origin) { | |
| 504 location_ -= origin.OffsetFromOrigin(); | |
| 505 root_location_ -= origin.OffsetFromOrigin(); | |
| 506 } | |
| 507 | |
| 508 void TouchEvent::UpdateForRootTransform( | 503 void TouchEvent::UpdateForRootTransform( |
| 509 const gfx::Transform& inverted_root_transform) { | 504 const gfx::Transform& inverted_root_transform) { |
| 510 LocatedEvent::UpdateForRootTransform(inverted_root_transform); | 505 LocatedEvent::UpdateForRootTransform(inverted_root_transform); |
| 511 gfx::DecomposedTransform decomp; | 506 gfx::DecomposedTransform decomp; |
| 512 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); | 507 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); |
| 513 DCHECK(success); | 508 DCHECK(success); |
| 514 if (decomp.scale[0]) | 509 if (decomp.scale[0]) |
| 515 radius_x_ *= decomp.scale[0]; | 510 radius_x_ *= decomp.scale[0]; |
| 516 if (decomp.scale[1]) | 511 if (decomp.scale[1]) |
| 517 radius_y_ *= decomp.scale[1]; | 512 radius_y_ *= decomp.scale[1]; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 int GestureEvent::GetLowestTouchId() const { | 726 int GestureEvent::GetLowestTouchId() const { |
| 732 if (touch_ids_bitfield_ == 0) | 727 if (touch_ids_bitfield_ == 0) |
| 733 return -1; | 728 return -1; |
| 734 int i = -1; | 729 int i = -1; |
| 735 // Find the index of the least significant 1 bit | 730 // Find the index of the least significant 1 bit |
| 736 while (!(1 << ++i & touch_ids_bitfield_)); | 731 while (!(1 << ++i & touch_ids_bitfield_)); |
| 737 return i; | 732 return i; |
| 738 } | 733 } |
| 739 | 734 |
| 740 } // namespace ui | 735 } // namespace ui |
| OLD | NEW |