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/ws/event_dispatcher.h" | 5 #include "components/mus/ws/event_dispatcher.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "cc/surfaces/surface_hittest.h" | 9 #include "cc/surfaces/surface_hittest.h" |
10 #include "components/mus/surfaces/surfaces_state.h" | 10 #include "components/mus/surfaces/surfaces_state.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const int32_t pointer_id = event->pointer_data->pointer_id; | 208 const int32_t pointer_id = event->pointer_data->pointer_id; |
209 if (event->action == mojom::EVENT_TYPE_WHEEL || | 209 if (event->action == mojom::EVENT_TYPE_WHEEL || |
210 (event->action == mojom::EVENT_TYPE_POINTER_MOVE && | 210 (event->action == mojom::EVENT_TYPE_POINTER_MOVE && |
211 pointer_targets_.count(pointer_id) == 0)) { | 211 pointer_targets_.count(pointer_id) == 0)) { |
212 PointerTarget pointer_target; | 212 PointerTarget pointer_target; |
213 if (pointer_targets_.count(pointer_id) != 0) { | 213 if (pointer_targets_.count(pointer_id) != 0) { |
214 pointer_target = pointer_targets_[pointer_id]; | 214 pointer_target = pointer_targets_[pointer_id]; |
215 } else { | 215 } else { |
216 gfx::Point location(EventLocationToPoint(*event)); | 216 gfx::Point location(EventLocationToPoint(*event)); |
217 pointer_target.window = | 217 pointer_target.window = |
218 FindDeepestVisibleWindow(root_, surface_id_, &location); | 218 FindDeepestVisibleWindowForEvents(root_, surface_id_, &location); |
219 } | 219 } |
220 DispatchToPointerTarget(pointer_target, event.Pass()); | 220 DispatchToPointerTarget(pointer_target, event.Pass()); |
221 return; | 221 return; |
222 } | 222 } |
223 | 223 |
224 // Pointer down implicitly captures. | 224 // Pointer down implicitly captures. |
225 if (pointer_targets_.count(pointer_id) == 0) { | 225 if (pointer_targets_.count(pointer_id) == 0) { |
226 DCHECK(event->action == mojom::EVENT_TYPE_POINTER_DOWN); | 226 DCHECK(event->action == mojom::EVENT_TYPE_POINTER_DOWN); |
227 const bool is_first_pointer_down = pointer_targets_.empty(); | 227 const bool is_first_pointer_down = pointer_targets_.empty(); |
228 gfx::Point location(EventLocationToPoint(*event)); | 228 gfx::Point location(EventLocationToPoint(*event)); |
229 ServerWindow* target = | 229 ServerWindow* target = |
230 FindDeepestVisibleWindow(root_, surface_id_, &location); | 230 FindDeepestVisibleWindowForEvents(root_, surface_id_, &location); |
231 DCHECK(target); | 231 DCHECK(target); |
232 if (!IsObservingWindow(target)) | 232 if (!IsObservingWindow(target)) |
233 target->AddObserver(this); | 233 target->AddObserver(this); |
234 | 234 |
235 pointer_targets_[pointer_id].window = target; | 235 pointer_targets_[pointer_id].window = target; |
236 pointer_targets_[pointer_id].in_nonclient_area = | 236 pointer_targets_[pointer_id].in_nonclient_area = |
237 IsLocationInNonclientArea(target, location); | 237 IsLocationInNonclientArea(target, location); |
238 | 238 |
239 if (is_first_pointer_down) | 239 if (is_first_pointer_down) |
240 delegate_->SetFocusedWindowFromEventDispatcher(target); | 240 delegate_->SetFocusedWindowFromEventDispatcher(target); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) { | 310 void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) { |
311 CancelPointerEventsToTarget(window); | 311 CancelPointerEventsToTarget(window); |
312 } | 312 } |
313 | 313 |
314 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { | 314 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { |
315 CancelPointerEventsToTarget(window); | 315 CancelPointerEventsToTarget(window); |
316 } | 316 } |
317 | 317 |
318 } // namespace ws | 318 } // namespace ws |
319 } // namespace mus | 319 } // namespace mus |
OLD | NEW |