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/aura/event.h" | 5 #include "ui/aura/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 |
11 #include <cstring> | 11 #include <cstring> |
12 | 12 |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/base/keycodes/keyboard_code_conversion.h" | 14 #include "ui/base/keycodes/keyboard_code_conversion.h" |
15 #include "ui/gfx/point3.h" | 15 #include "ui/gfx/point3.h" |
16 #include "ui/gfx/interpolated_transform.h" | |
16 #include "ui/gfx/transform.h" | 17 #include "ui/gfx/transform.h" |
17 | 18 |
18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
19 #include "ui/aura/event_mac.h" | 20 #include "ui/aura/event_mac.h" |
20 #endif | 21 #endif |
21 | 22 |
22 #if defined(USE_X11) | 23 #if defined(USE_X11) |
23 #include "ui/base/keycodes/keyboard_code_conversion_x.h" | 24 #include "ui/base/keycodes/keyboard_code_conversion_x.h" |
24 #endif | 25 #endif |
25 | 26 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 radius_x_(1.0f), | 274 radius_x_(1.0f), |
274 radius_y_(1.0f), | 275 radius_y_(1.0f), |
275 rotation_angle_(0.0f), | 276 rotation_angle_(0.0f), |
276 force_(0.0f) { | 277 force_(0.0f) { |
277 set_time_stamp(time_stamp); | 278 set_time_stamp(time_stamp); |
278 } | 279 } |
279 | 280 |
280 TouchEvent::~TouchEvent() { | 281 TouchEvent::~TouchEvent() { |
281 } | 282 } |
282 | 283 |
284 void TouchEvent::UpdateForRootTransform(const ui::Transform& root_transform) { | |
285 LocatedEvent::UpdateForRootTransform(root_transform); | |
286 gfx::Point3f scale; | |
287 ui::InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); | |
288 radius_x_ *= scale.x(); | |
289 radius_y_ *= scale.y(); | |
290 } | |
291 | |
283 ui::EventType TouchEvent::GetEventType() const { | 292 ui::EventType TouchEvent::GetEventType() const { |
284 return type(); | 293 return type(); |
285 } | 294 } |
286 | 295 |
287 gfx::Point TouchEvent::GetLocation() const { | 296 gfx::Point TouchEvent::GetLocation() const { |
288 return location(); | 297 return location(); |
289 } | 298 } |
290 | 299 |
291 int TouchEvent::GetTouchId() const { | 300 int TouchEvent::GetTouchId() const { |
292 return touch_id_; | 301 return touch_id_; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 Window* target) | 456 Window* target) |
448 : LocatedEvent(model, source, target), | 457 : LocatedEvent(model, source, target), |
449 delta_x_(model.delta_x_), | 458 delta_x_(model.delta_x_), |
450 delta_y_(model.delta_y_), | 459 delta_y_(model.delta_y_), |
451 touch_ids_bitfield_(model.touch_ids_bitfield_) { | 460 touch_ids_bitfield_(model.touch_ids_bitfield_) { |
452 } | 461 } |
453 | 462 |
454 GestureEvent::~GestureEvent() { | 463 GestureEvent::~GestureEvent() { |
455 } | 464 } |
456 | 465 |
466 void GestureEvent::UpdateForRootTransform(const ui::Transform& root_transform) { | |
467 LocatedEvent::UpdateForRootTransform(root_transform); | |
468 gfx::Point3f scale; | |
469 ui::InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); | |
470 delta_x_ *= scale.x(); | |
471 delta_y_ *= scale.y(); | |
sadrul
2012/04/22 19:35:55
Are you sure the change here is necessary? The pin
pkotwicz
2012/04/23 00:15:40
You are right that UpdateForRootTransform is never
sadrul
2012/04/23 01:13:51
I actually meant that the scale-factor on the root
| |
472 } | |
473 | |
457 int GestureEvent::GetLowestTouchId() const { | 474 int GestureEvent::GetLowestTouchId() const { |
458 if (touch_ids_bitfield_ == 0) | 475 if (touch_ids_bitfield_ == 0) |
459 return -1; | 476 return -1; |
460 int i = -1; | 477 int i = -1; |
461 // Find the index of the least significant 1 bit | 478 // Find the index of the least significant 1 bit |
462 while (!(1 << ++i & touch_ids_bitfield_)); | 479 while (!(1 << ++i & touch_ids_bitfield_)); |
463 return i; | 480 return i; |
464 } | 481 } |
465 | 482 |
466 } // namespace aura | 483 } // namespace aura |
OLD | NEW |