| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // Constrain the mouse position within the new root Window size. | 587 // Constrain the mouse position within the new root Window size. |
| 588 gfx::Point point; | 588 gfx::Point point; |
| 589 if (host_->QueryMouseLocation(&point)) { | 589 if (host_->QueryMouseLocation(&point)) { |
| 590 SetLastMouseLocation( | 590 SetLastMouseLocation( |
| 591 host_->window(), | 591 host_->window(), |
| 592 ui::ConvertPointToDIP(host_->window()->layer(), point)); | 592 ui::ConvertPointToDIP(host_->window()->layer(), point)); |
| 593 } | 593 } |
| 594 synthesize_mouse_move_ = false; | 594 synthesize_mouse_move_ = false; |
| 595 } | 595 } |
| 596 | 596 |
| 597 if (window->IsVisible()) { | 597 if (window->IsVisible() && !window->ignore_events()) { |
| 598 gfx::Rect old_bounds_in_root = old_bounds, new_bounds_in_root = new_bounds; | 598 gfx::Rect old_bounds_in_root = old_bounds, new_bounds_in_root = new_bounds; |
| 599 Window::ConvertRectToTarget(window->parent(), host_->window(), | 599 Window::ConvertRectToTarget(window->parent(), host_->window(), |
| 600 &old_bounds_in_root); | 600 &old_bounds_in_root); |
| 601 Window::ConvertRectToTarget(window->parent(), host_->window(), | 601 Window::ConvertRectToTarget(window->parent(), host_->window(), |
| 602 &new_bounds_in_root); | 602 &new_bounds_in_root); |
| 603 gfx::Point last_mouse_location = GetLastMouseLocationInRoot(); | 603 gfx::Point last_mouse_location = GetLastMouseLocationInRoot(); |
| 604 if (old_bounds_in_root.Contains(last_mouse_location) != | 604 if (old_bounds_in_root.Contains(last_mouse_location) != |
| 605 new_bounds_in_root.Contains(last_mouse_location)) { | 605 new_bounds_in_root.Contains(last_mouse_location)) { |
| 606 PostSynthesizeMouseMove(); | 606 PostSynthesizeMouseMove(); |
| 607 } | 607 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 ui::EventDispatchDetails WindowEventDispatcher::SynthesizeMouseMoveEvent() { | 691 ui::EventDispatchDetails WindowEventDispatcher::SynthesizeMouseMoveEvent() { |
| 692 DispatchDetails details; | 692 DispatchDetails details; |
| 693 if (!synthesize_mouse_move_) | 693 if (!synthesize_mouse_move_) |
| 694 return details; | 694 return details; |
| 695 synthesize_mouse_move_ = false; | 695 synthesize_mouse_move_ = false; |
| 696 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); | 696 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); |
| 697 if (!window()->bounds().Contains(root_mouse_location)) | 697 if (!window()->bounds().Contains(root_mouse_location)) |
| 698 return details; | 698 return details; |
| 699 gfx::Point host_mouse_location = root_mouse_location; | 699 gfx::Point host_mouse_location = root_mouse_location; |
| 700 host_->ConvertPointToHost(&host_mouse_location); | 700 host_->ConvertPointToHost(&host_mouse_location); |
| 701 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 701 ui::EventType event_type = ui::ET_MOUSE_MOVED; |
| 702 int flags = ui::EF_IS_SYNTHESIZED; |
| 703 if (Env::GetInstance()->IsMouseButtonDown()) { |
| 704 event_type = ui::ET_MOUSE_DRAGGED; |
| 705 flags |= Env::GetInstance()->mouse_button_flags(); |
| 706 } |
| 707 ui::MouseEvent event(event_type, |
| 702 host_mouse_location, | 708 host_mouse_location, |
| 703 host_mouse_location, | 709 host_mouse_location, |
| 704 ui::EF_IS_SYNTHESIZED, | 710 flags, |
| 705 0); | 711 0); |
| 706 return OnEventFromSource(&event); | 712 return OnEventFromSource(&event); |
| 707 } | 713 } |
| 708 | 714 |
| 709 void WindowEventDispatcher::PreDispatchLocatedEvent(Window* target, | 715 void WindowEventDispatcher::PreDispatchLocatedEvent(Window* target, |
| 710 ui::LocatedEvent* event) { | 716 ui::LocatedEvent* event) { |
| 711 int flags = event->flags(); | 717 int flags = event->flags(); |
| 712 if (IsNonClientLocation(target, event->location())) | 718 if (IsNonClientLocation(target, event->location())) |
| 713 flags |= ui::EF_IS_NON_CLIENT; | 719 flags |= ui::EF_IS_NON_CLIENT; |
| 714 event->set_flags(flags); | 720 event->set_flags(flags); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 break; | 859 break; |
| 854 | 860 |
| 855 default: | 861 default: |
| 856 NOTREACHED(); | 862 NOTREACHED(); |
| 857 break; | 863 break; |
| 858 } | 864 } |
| 859 PreDispatchLocatedEvent(target, event); | 865 PreDispatchLocatedEvent(target, event); |
| 860 } | 866 } |
| 861 | 867 |
| 862 } // namespace aura | 868 } // namespace aura |
| OLD | NEW |