OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/gesture_manager.h" | 5 #include "components/mus/gesture_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "components/mus/gesture_manager_delegate.h" | 9 #include "components/mus/gesture_manager_delegate.h" |
10 #include "components/mus/public/cpp/keys.h" | 10 #include "components/mus/public/cpp/keys.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // TODO(sky): I'm doing this until things are converted. Seems as though we | 48 // TODO(sky): I'm doing this until things are converted. Seems as though we |
49 // shouldn't do this long term. | 49 // shouldn't do this long term. |
50 if (result.empty()) | 50 if (result.empty()) |
51 result.push_back(deepest); | 51 result.push_back(deepest); |
52 return result; | 52 return result; |
53 } | 53 } |
54 | 54 |
55 mojo::EventPtr CloneEventForView(const mojo::Event& event, | 55 mojo::EventPtr CloneEventForView(const mojo::Event& event, |
56 const ServerView* view) { | 56 const ServerView* view) { |
57 mojo::EventPtr result(event.Clone()); | 57 mojo::EventPtr result(event.Clone()); |
58 const gfx::PointF location(event.pointer_data->x, event.pointer_data->y); | 58 const gfx::PointF location(event.pointer_data->location->x, |
| 59 event.pointer_data->location->y); |
59 const gfx::PointF target_location( | 60 const gfx::PointF target_location( |
60 ConvertPointFBetweenViews(view->GetRoot(), view, location)); | 61 ConvertPointFBetweenViews(view->GetRoot(), view, location)); |
61 result->pointer_data->x = target_location.x(); | 62 result->pointer_data->location->x = target_location.x(); |
62 result->pointer_data->y = target_location.y(); | 63 result->pointer_data->location->y = target_location.y(); |
63 return result.Pass(); | 64 return result.Pass(); |
64 } | 65 } |
65 | 66 |
66 } // namespace | 67 } // namespace |
67 | 68 |
68 // GestureStateChange ---------------------------------------------------------- | 69 // GestureStateChange ---------------------------------------------------------- |
69 | 70 |
70 GestureStateChange::GestureStateChange() | 71 GestureStateChange::GestureStateChange() |
71 : chosen_gesture(GestureManager::kInvalidGestureId) {} | 72 : chosen_gesture(GestureManager::kInvalidGestureId) {} |
72 | 73 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // Explicitly delete the pointers first as this may result in calling back to | 532 // Explicitly delete the pointers first as this may result in calling back to |
532 // us to cleanup and delete gestures. | 533 // us to cleanup and delete gestures. |
533 active_pointers_.clear(); | 534 active_pointers_.clear(); |
534 } | 535 } |
535 | 536 |
536 bool GestureManager::ProcessEvent(const mojo::Event& event) { | 537 bool GestureManager::ProcessEvent(const mojo::Event& event) { |
537 if (!event.pointer_data) | 538 if (!event.pointer_data) |
538 return false; | 539 return false; |
539 | 540 |
540 ScheduledDeleteProcessor delete_processor(this); | 541 ScheduledDeleteProcessor delete_processor(this); |
541 const gfx::Point location(static_cast<int>(event.pointer_data->x), | 542 const gfx::Point location(static_cast<int>(event.pointer_data->location->x), |
542 static_cast<int>(event.pointer_data->y)); | 543 static_cast<int>(event.pointer_data->location->y)); |
543 switch (event.action) { | 544 switch (event.action) { |
544 case mojo::EVENT_TYPE_POINTER_DOWN: { | 545 case mojo::EVENT_TYPE_POINTER_DOWN: { |
545 if (GetPointerById(event.pointer_data->pointer_id)) { | 546 if (GetPointerById(event.pointer_data->pointer_id)) { |
546 DVLOG(1) << "received more than one down for a pointer without a " | 547 DVLOG(1) << "received more than one down for a pointer without a " |
547 << "corresponding up, id=" << event.pointer_data->pointer_id; | 548 << "corresponding up, id=" << event.pointer_data->pointer_id; |
548 NOTREACHED(); | 549 NOTREACHED(); |
549 return true; | 550 return true; |
550 } | 551 } |
551 | 552 |
552 const ServerView* deepest = FindDeepestVisibleView(root_view_, location); | 553 const ServerView* deepest = FindDeepestVisibleView(root_view_, location); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 void GestureManager::ScheduleDelete(Pointer* pointer) { | 687 void GestureManager::ScheduleDelete(Pointer* pointer) { |
687 auto iter = | 688 auto iter = |
688 std::find(active_pointers_.begin(), active_pointers_.end(), pointer); | 689 std::find(active_pointers_.begin(), active_pointers_.end(), pointer); |
689 if (iter != active_pointers_.end()) { | 690 if (iter != active_pointers_.end()) { |
690 active_pointers_.weak_erase(iter); | 691 active_pointers_.weak_erase(iter); |
691 pointers_to_delete_.push_back(pointer); | 692 pointers_to_delete_.push_back(pointer); |
692 } | 693 } |
693 } | 694 } |
694 | 695 |
695 } // namespace mus | 696 } // namespace mus |
OLD | NEW |