| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "components/mus/ws/accelerator.h" | 10 #include "components/mus/ws/accelerator.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 if (pair.second->MatchesEvent(event, phase)) { | 503 if (pair.second->MatchesEvent(event, phase)) { |
| 504 return pair.second.get(); | 504 return pair.second.get(); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 return nullptr; | 507 return nullptr; |
| 508 } | 508 } |
| 509 | 509 |
| 510 void EventDispatcher::OnWillChangeWindowHierarchy(ServerWindow* window, | 510 void EventDispatcher::OnWillChangeWindowHierarchy(ServerWindow* window, |
| 511 ServerWindow* new_parent, | 511 ServerWindow* new_parent, |
| 512 ServerWindow* old_parent) { | 512 ServerWindow* old_parent) { |
| 513 CancelPointerEventsToTarget(window); | 513 // TODO(sky): moving to a different root likely needs to transfer capture. |
| 514 // TODO(sky): this isn't quite right, I think the logic should be (assuming |
| 515 // moving in same root and still drawn): |
| 516 // . if there is capture and window is still in the same root, continue |
| 517 // sending to it. |
| 518 // . if there isn't capture, then reevaluate each of the pointer targets |
| 519 // sending exit as necessary. |
| 520 // http://crbug.com/613646 . |
| 521 if (!new_parent || !new_parent->IsDrawn() || |
| 522 new_parent->GetRoot() != old_parent->GetRoot()) { |
| 523 CancelPointerEventsToTarget(window); |
| 524 } |
| 514 } | 525 } |
| 515 | 526 |
| 516 void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) { | 527 void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) { |
| 517 CancelPointerEventsToTarget(window); | 528 CancelPointerEventsToTarget(window); |
| 518 } | 529 } |
| 519 | 530 |
| 520 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { | 531 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { |
| 521 CancelPointerEventsToTarget(window); | 532 CancelPointerEventsToTarget(window); |
| 522 | 533 |
| 523 if (mouse_cursor_source_window_ == window) | 534 if (mouse_cursor_source_window_ == window) |
| 524 mouse_cursor_source_window_ = nullptr; | 535 mouse_cursor_source_window_ = nullptr; |
| 525 } | 536 } |
| 526 | 537 |
| 527 } // namespace ws | 538 } // namespace ws |
| 528 } // namespace mus | 539 } // namespace mus |
| OLD | NEW |