| 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 mus { | 17 namespace view_manager { | 
| 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(kViewManagerKeyWantsTouchEvents)) { | 39     if (view->properties().count(mojo::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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 685 | 685 | 
| 686 void GestureManager::ScheduleDelete(Pointer* pointer) { | 686 void GestureManager::ScheduleDelete(Pointer* pointer) { | 
| 687   auto iter = | 687   auto iter = | 
| 688       std::find(active_pointers_.begin(), active_pointers_.end(), pointer); | 688       std::find(active_pointers_.begin(), active_pointers_.end(), pointer); | 
| 689   if (iter != active_pointers_.end()) { | 689   if (iter != active_pointers_.end()) { | 
| 690     active_pointers_.weak_erase(iter); | 690     active_pointers_.weak_erase(iter); | 
| 691     pointers_to_delete_.push_back(pointer); | 691     pointers_to_delete_.push_back(pointer); | 
| 692   } | 692   } | 
| 693 } | 693 } | 
| 694 | 694 | 
| 695 }  // namespace mus | 695 }  // namespace view_manager | 
| OLD | NEW | 
|---|