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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 window->ContainsPointInRoot(GetLastMouseLocationInRoot())) { | 687 window->ContainsPointInRoot(GetLastMouseLocationInRoot())) { |
688 PostSynthesizeMouseMove(); | 688 PostSynthesizeMouseMove(); |
689 } | 689 } |
690 } | 690 } |
691 | 691 |
692 ui::EventDispatchDetails WindowEventDispatcher::SynthesizeMouseMoveEvent() { | 692 ui::EventDispatchDetails WindowEventDispatcher::SynthesizeMouseMoveEvent() { |
693 DispatchDetails details; | 693 DispatchDetails details; |
694 if (!synthesize_mouse_move_) | 694 if (!synthesize_mouse_move_) |
695 return details; | 695 return details; |
696 synthesize_mouse_move_ = false; | 696 synthesize_mouse_move_ = false; |
| 697 |
| 698 // If one of the mouse buttons is currently down, then do not synthesize a |
| 699 // mouse-move event. In such cases, aura could synthesize a DRAGGED event |
| 700 // instead of a MOVED event, but in multi-display/multi-host scenarios, the |
| 701 // DRAGGED event can be synthesized in the incorrect host. So avoid |
| 702 // synthesizing any events at all. |
| 703 if (Env::GetInstance()->mouse_button_flags()) |
| 704 return details; |
| 705 |
697 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); | 706 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); |
698 if (!window()->bounds().Contains(root_mouse_location)) | 707 if (!window()->bounds().Contains(root_mouse_location)) |
699 return details; | 708 return details; |
700 gfx::Point host_mouse_location = root_mouse_location; | 709 gfx::Point host_mouse_location = root_mouse_location; |
701 host_->ConvertPointToHost(&host_mouse_location); | 710 host_->ConvertPointToHost(&host_mouse_location); |
702 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 711 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
703 host_mouse_location, | 712 host_mouse_location, |
704 host_mouse_location, | 713 host_mouse_location, |
705 ui::EF_IS_SYNTHESIZED, | 714 ui::EF_IS_SYNTHESIZED, |
706 0); | 715 0); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 break; | 863 break; |
855 | 864 |
856 default: | 865 default: |
857 NOTREACHED(); | 866 NOTREACHED(); |
858 break; | 867 break; |
859 } | 868 } |
860 PreDispatchLocatedEvent(target, event); | 869 PreDispatchLocatedEvent(target, event); |
861 } | 870 } |
862 | 871 |
863 } // namespace aura | 872 } // namespace aura |
OLD | NEW |