OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/root_window.h" | 5 #include "ui/aura/root_window.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 | 773 |
774 bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) { | 774 bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) { |
775 DispatchHeldMouseMove(); | 775 DispatchHeldMouseMove(); |
776 | 776 |
777 TransformEventForDeviceScaleFactor(event); | 777 TransformEventForDeviceScaleFactor(event); |
778 SetLastMouseLocation(this, event->location()); | 778 SetLastMouseLocation(this, event->location()); |
779 synthesize_mouse_move_ = false; | 779 synthesize_mouse_move_ = false; |
780 | 780 |
781 Window* target = mouse_pressed_handler_ ? | 781 Window* target = mouse_pressed_handler_ ? |
782 mouse_pressed_handler_ : client::GetCaptureWindow(this); | 782 mouse_pressed_handler_ : client::GetCaptureWindow(this); |
| 783 |
783 if (!target) | 784 if (!target) |
784 target = GetEventHandlerForPoint(event->location()); | 785 target = GetEventHandlerForPoint(event->location()); |
785 | 786 |
786 if (target && target->delegate()) { | 787 if (!target) |
787 int flags = event->flags(); | 788 target = this; |
788 gfx::Point location_in_window = event->location(); | 789 |
789 Window::ConvertPointToTarget(this, target, &location_in_window); | 790 int flags = event->flags(); |
790 if (IsNonClientLocation(target, location_in_window)) | 791 gfx::Point location_in_window = event->location(); |
791 flags |= ui::EF_IS_NON_CLIENT; | 792 Window::ConvertPointToTarget(this, target, &location_in_window); |
792 event->set_flags(flags); | 793 if (IsNonClientLocation(target, location_in_window)) |
793 event->ConvertLocationToTarget(static_cast<Window*>(this), target); | 794 flags |= ui::EF_IS_NON_CLIENT; |
794 ProcessEvent(target, event); | 795 event->set_flags(flags); |
795 return event->handled(); | 796 event->ConvertLocationToTarget(static_cast<Window*>(this), target); |
796 } | 797 ProcessEvent(target, event); |
797 return false; | 798 return event->handled(); |
798 } | 799 } |
799 | 800 |
800 bool RootWindow::OnHostTouchEvent(ui::TouchEvent* event) { | 801 bool RootWindow::OnHostTouchEvent(ui::TouchEvent* event) { |
801 DispatchHeldMouseMove(); | 802 DispatchHeldMouseMove(); |
802 switch (event->type()) { | 803 switch (event->type()) { |
803 case ui::ET_TOUCH_PRESSED: | 804 case ui::ET_TOUCH_PRESSED: |
804 touch_ids_down_ |= (1 << event->touch_id()); | 805 touch_ids_down_ |= (1 << event->touch_id()); |
805 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); | 806 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); |
806 break; | 807 break; |
807 | 808 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1003 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
1003 orig_mouse_location, | 1004 orig_mouse_location, |
1004 orig_mouse_location, | 1005 orig_mouse_location, |
1005 ui::EF_IS_SYNTHESIZED); | 1006 ui::EF_IS_SYNTHESIZED); |
1006 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1007 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
1007 OnHostMouseEvent(&event); | 1008 OnHostMouseEvent(&event); |
1008 #endif | 1009 #endif |
1009 } | 1010 } |
1010 | 1011 |
1011 } // namespace aura | 1012 } // namespace aura |
OLD | NEW |