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( | 76 const gfx::Point root_point(static_cast<int>(event->pointer_data->x), |
77 static_cast<int>(event->pointer_data->location->x), | 77 static_cast<int>(event->pointer_data->y)); |
78 static_cast<int>(event->pointer_data->location->y)); | |
79 ServerView* target = focused_view; | 78 ServerView* target = focused_view; |
80 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || | 79 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target || |
81 !root->Contains(target)) { | 80 !root->Contains(target)) { |
82 target = FindDeepestVisibleView(root, root_point); | 81 target = FindDeepestVisibleView(root, root_point); |
83 CHECK(target); | 82 CHECK(target); |
84 } | 83 } |
85 const gfx::PointF local_point(ConvertPointFBetweenViews( | 84 const gfx::PointF local_point(ConvertPointFBetweenViews( |
86 root, target, gfx::PointF(event->pointer_data->location->x, | 85 root, target, |
87 event->pointer_data->location->y))); | 86 gfx::PointF(event->pointer_data->x, event->pointer_data->y))); |
88 event->pointer_data->location->x = local_point.x(); | 87 event->pointer_data->x = local_point.x(); |
89 event->pointer_data->location->y = local_point.y(); | 88 event->pointer_data->y = local_point.y(); |
90 return target; | 89 return target; |
91 } | 90 } |
92 | 91 |
93 return focused_view; | 92 return focused_view; |
94 } | 93 } |
95 | 94 |
96 } // namespace view_manager | 95 } // namespace view_manager |
OLD | NEW |