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" |
11 #include "components/mus/server_view.h" | 11 #include "components/mus/server_view.h" |
12 #include "components/mus/view_coordinate_conversions.h" | 12 #include "components/mus/view_coordinate_conversions.h" |
13 #include "components/mus/view_locator.h" | 13 #include "components/mus/view_locator.h" |
14 #include "ui/gfx/geometry/point_f.h" | 14 #include "ui/gfx/geometry/point_f.h" |
15 #include "ui/mojo/events/input_events.mojom.h" | 15 #include "ui/mojo/events/input_events.mojom.h" |
16 | 16 |
17 namespace view_manager { | 17 namespace mus { |
18 | 18 |
19 using Views = std::vector<const ServerView*>; | 19 using Views = std::vector<const ServerView*>; |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 GestureManager::GestureAndConnectionId MakeGestureAndConnectionId( | 23 GestureManager::GestureAndConnectionId MakeGestureAndConnectionId( |
24 const ServerView* view, | 24 const ServerView* view, |
25 uint32_t gesture_id) { | 25 uint32_t gesture_id) { |
26 return (static_cast<GestureManager::GestureAndConnectionId>( | 26 return (static_cast<GestureManager::GestureAndConnectionId>( |
27 view->id().connection_id) | 27 view->id().connection_id) |
28 << 32) | | 28 << 32) | |
29 gesture_id; | 29 gesture_id; |
30 } | 30 } |
31 | 31 |
32 // Returns the views (deepest first) that should receive touch events. This only | 32 // Returns the views (deepest first) that should receive touch events. This only |
33 // returns one view per connection. If multiple views from the same connection | 33 // returns one view per connection. If multiple views from the same connection |
34 // are interested in touch events the shallowest view is returned. | 34 // are interested in touch events the shallowest view is returned. |
35 Views GetTouchTargets(const ServerView* deepest) { | 35 Views GetTouchTargets(const ServerView* deepest) { |
36 Views result; | 36 Views result; |
37 const ServerView* view = deepest; | 37 const ServerView* view = deepest; |
38 while (view) { | 38 while (view) { |
39 if (view->properties().count(mojo::kViewManagerKeyWantsTouchEvents)) { | 39 if (view->properties().count(kViewManagerKeyWantsTouchEvents)) { |
40 if (!result.empty() && | 40 if (!result.empty() && |
41 result.back()->id().connection_id == view->id().connection_id) { | 41 result.back()->id().connection_id == view->id().connection_id) { |
42 result.pop_back(); | 42 result.pop_back(); |
43 } | 43 } |
44 result.push_back(view); | 44 result.push_back(view); |
45 } | 45 } |
46 view = view->parent(); | 46 view = view->parent(); |
47 } | 47 } |
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. |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 | 686 |
687 void GestureManager::ScheduleDelete(Pointer* pointer) { | 687 void GestureManager::ScheduleDelete(Pointer* pointer) { |
688 auto iter = | 688 auto iter = |
689 std::find(active_pointers_.begin(), active_pointers_.end(), pointer); | 689 std::find(active_pointers_.begin(), active_pointers_.end(), pointer); |
690 if (iter != active_pointers_.end()) { | 690 if (iter != active_pointers_.end()) { |
691 active_pointers_.weak_erase(iter); | 691 active_pointers_.weak_erase(iter); |
692 pointers_to_delete_.push_back(pointer); | 692 pointers_to_delete_.push_back(pointer); |
693 } | 693 } |
694 } | 694 } |
695 | 695 |
696 } // namespace view_manager | 696 } // namespace mus |
OLD | NEW |