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/event_dispatcher.h" | 5 #include "components/mus/event_dispatcher.h" |
6 | 6 |
7 #include "components/mus/server_view.h" | 7 #include "components/mus/server_view.h" |
8 #include "components/mus/view_coordinate_conversions.h" | 8 #include "components/mus/view_coordinate_conversions.h" |
9 #include "components/mus/view_locator.h" | 9 #include "components/mus/view_locator.h" |
10 #include "components/mus/view_tree_host_impl.h" | 10 #include "components/mus/view_tree_host_impl.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return true; | 66 return true; |
67 } | 67 } |
68 } | 68 } |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
72 ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) { | 72 ServerView* EventDispatcher::FindEventTarget(mojo::Event* event) { |
73 ServerView* focused_view = view_tree_host_->GetFocusedView(); | 73 ServerView* focused_view = view_tree_host_->GetFocusedView(); |
74 if (event->pointer_data) { | 74 if (event->pointer_data) { |
75 ServerView* root = view_tree_host_->root_view(); | 75 ServerView* root = view_tree_host_->root_view(); |
76 const gfx::Point root_point(static_cast<int>(event->pointer_data->x), | 76 const gfx::Point root_point( |
77 static_cast<int>(event->pointer_data->y)); | 77 static_cast<int>(event->pointer_data->location->x), |
| 78 static_cast<int>(event->pointer_data->location->y)); |
78 ServerView* target = focused_view; | 79 ServerView* target = focused_view; |
79 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || | 80 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || |
80 !root->Contains(target)) { | 81 !root->Contains(target)) { |
81 target = FindDeepestVisibleView(root, root_point); | 82 target = FindDeepestVisibleView(root, root_point); |
82 CHECK(target); | 83 CHECK(target); |
83 } | 84 } |
84 const gfx::PointF local_point(ConvertPointFBetweenViews( | 85 const gfx::PointF local_point(ConvertPointFBetweenViews( |
85 root, target, | 86 root, target, gfx::PointF(event->pointer_data->location->x, |
86 gfx::PointF(event->pointer_data->x, event->pointer_data->y))); | 87 event->pointer_data->location->y))); |
87 event->pointer_data->x = local_point.x(); | 88 event->pointer_data->location->x = local_point.x(); |
88 event->pointer_data->y = local_point.y(); | 89 event->pointer_data->location->y = local_point.y(); |
89 return target; | 90 return target; |
90 } | 91 } |
91 | 92 |
92 return focused_view; | 93 return focused_view; |
93 } | 94 } |
94 | 95 |
95 } // namespace mus | 96 } // namespace mus |
OLD | NEW |