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