| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 457 } |
| 458 | 458 |
| 459 TouchEvent::~TouchEvent() { | 459 TouchEvent::~TouchEvent() { |
| 460 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 | 460 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 |
| 461 // platform setups the tracking_id to slot mapping. So in dtor here, | 461 // platform setups the tracking_id to slot mapping. So in dtor here, |
| 462 // if this touch event is a release event, we clear the mapping accordingly. | 462 // if this touch event is a release event, we clear the mapping accordingly. |
| 463 if (HasNativeEvent()) | 463 if (HasNativeEvent()) |
| 464 ClearTouchIdIfReleased(native_event()); | 464 ClearTouchIdIfReleased(native_event()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void TouchEvent::Relocate(const gfx::Point& origin) { | |
| 468 location_ -= origin.OffsetFromOrigin(); | |
| 469 root_location_ -= origin.OffsetFromOrigin(); | |
| 470 } | |
| 471 | |
| 472 void TouchEvent::UpdateForRootTransform( | 467 void TouchEvent::UpdateForRootTransform( |
| 473 const gfx::Transform& inverted_root_transform) { | 468 const gfx::Transform& inverted_root_transform) { |
| 474 LocatedEvent::UpdateForRootTransform(inverted_root_transform); | 469 LocatedEvent::UpdateForRootTransform(inverted_root_transform); |
| 475 gfx::DecomposedTransform decomp; | 470 gfx::DecomposedTransform decomp; |
| 476 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); | 471 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform); |
| 477 DCHECK(success); | 472 DCHECK(success); |
| 478 if (decomp.scale[0]) | 473 if (decomp.scale[0]) |
| 479 radius_x_ *= decomp.scale[0]; | 474 radius_x_ *= decomp.scale[0]; |
| 480 if (decomp.scale[1]) | 475 if (decomp.scale[1]) |
| 481 radius_y_ *= decomp.scale[1]; | 476 radius_y_ *= decomp.scale[1]; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 int GestureEvent::GetLowestTouchId() const { | 690 int GestureEvent::GetLowestTouchId() const { |
| 696 if (touch_ids_bitfield_ == 0) | 691 if (touch_ids_bitfield_ == 0) |
| 697 return -1; | 692 return -1; |
| 698 int i = -1; | 693 int i = -1; |
| 699 // Find the index of the least significant 1 bit | 694 // Find the index of the least significant 1 bit |
| 700 while (!(1 << ++i & touch_ids_bitfield_)); | 695 while (!(1 << ++i & touch_ids_bitfield_)); |
| 701 return i; | 696 return i; |
| 702 } | 697 } |
| 703 | 698 |
| 704 } // namespace ui | 699 } // namespace ui |
| OLD | NEW |