| 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 "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "cc/surfaces/surface_hittest.h" | 10 #include "cc/surfaces/surface_hittest.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return true; | 364 return true; |
| 365 } | 365 } |
| 366 return false; | 366 return false; |
| 367 } | 367 } |
| 368 | 368 |
| 369 void EventDispatcher::DispatchToPointerTarget(const PointerTarget& target, | 369 void EventDispatcher::DispatchToPointerTarget(const PointerTarget& target, |
| 370 const ui::PointerEvent& event) { | 370 const ui::PointerEvent& event) { |
| 371 if (!target.window) | 371 if (!target.window) |
| 372 return; | 372 return; |
| 373 | 373 |
| 374 // Transform the event to the target's coordinate system. The root_location |
| 375 // is not changed because each EventDispatcher manages a single root. |
| 374 gfx::Point location(event.location()); | 376 gfx::Point location(event.location()); |
| 375 gfx::Transform transform(GetTransformToWindow(surface_id_, target.window)); | 377 gfx::Transform transform(GetTransformToWindow(surface_id_, target.window)); |
| 376 transform.TransformPoint(&location); | 378 transform.TransformPoint(&location); |
| 377 scoped_ptr<ui::Event> clone = ui::Event::Clone(event); | 379 scoped_ptr<ui::Event> clone = ui::Event::Clone(event); |
| 378 clone->AsPointerEvent()->set_location(location); | 380 clone->AsPointerEvent()->set_location(location); |
| 379 // TODO(jonross): add post-target accelerator support once accelerators | 381 // TODO(jonross): add post-target accelerator support once accelerators |
| 380 // support pointer events. | 382 // support pointer events. |
| 381 delegate_->DispatchInputEventToWindow(target.window, target.in_nonclient_area, | 383 delegate_->DispatchInputEventToWindow(target.window, target.in_nonclient_area, |
| 382 *clone, nullptr); | 384 *clone, nullptr); |
| 383 } | 385 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 436 |
| 435 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { | 437 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { |
| 436 CancelPointerEventsToTarget(window); | 438 CancelPointerEventsToTarget(window); |
| 437 | 439 |
| 438 if (mouse_cursor_source_window_ == window) | 440 if (mouse_cursor_source_window_ == window) |
| 439 mouse_cursor_source_window_ = nullptr; | 441 mouse_cursor_source_window_ = nullptr; |
| 440 } | 442 } |
| 441 | 443 |
| 442 } // namespace ws | 444 } // namespace ws |
| 443 } // namespace mus | 445 } // namespace mus |
| OLD | NEW |