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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 ui::Transform transform = layer()->transform(); | 827 ui::Transform transform = layer()->transform(); |
828 transform.ConcatScale(scale, scale); | 828 transform.ConcatScale(scale, scale); |
829 event->UpdateForRootTransform(transform); | 829 event->UpdateForRootTransform(transform); |
830 | 830 |
831 SetLastMouseLocation(this, event->location()); | 831 SetLastMouseLocation(this, event->location()); |
832 synthesize_mouse_move_ = false; | 832 synthesize_mouse_move_ = false; |
833 | 833 |
834 Window* target = mouse_pressed_handler_ ? | 834 Window* target = mouse_pressed_handler_ ? |
835 mouse_pressed_handler_ : client::GetCaptureWindow(this); | 835 mouse_pressed_handler_ : client::GetCaptureWindow(this); |
836 if (!target) | 836 if (!target) |
837 target = GetEventHandlerForPoint(event->location()); | 837 target = GetEventHandlerForPoint(event->location(), event->type()); |
838 | 838 |
839 if (target && target->delegate()) { | 839 if (target && target->delegate()) { |
840 int flags = event->flags(); | 840 int flags = event->flags(); |
841 gfx::Point location_in_window = event->location(); | 841 gfx::Point location_in_window = event->location(); |
842 Window::ConvertPointToTarget(this, target, &location_in_window); | 842 Window::ConvertPointToTarget(this, target, &location_in_window); |
843 if (IsNonClientLocation(target, location_in_window)) | 843 if (IsNonClientLocation(target, location_in_window)) |
844 flags |= ui::EF_IS_NON_CLIENT; | 844 flags |= ui::EF_IS_NON_CLIENT; |
845 ui::ScrollEvent translated_event( | 845 ui::ScrollEvent translated_event( |
846 *event, static_cast<Window*>(this), target, event->type(), flags); | 846 *event, static_cast<Window*>(this), target, event->type(), flags); |
847 return ProcessMouseEvent(target, &translated_event); | 847 return ProcessMouseEvent(target, &translated_event); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 } | 884 } |
885 | 885 |
886 if (!target && !bounds().Contains(event->location())) { | 886 if (!target && !bounds().Contains(event->location())) { |
887 // If the initial touch is outside the root window, target the root. | 887 // If the initial touch is outside the root window, target the root. |
888 target = this; | 888 target = this; |
889 status = ProcessTouchEvent(target, event); | 889 status = ProcessTouchEvent(target, event); |
890 CHECK_EQ(ui::TOUCH_STATUS_UNKNOWN, status); | 890 CHECK_EQ(ui::TOUCH_STATUS_UNKNOWN, status); |
891 } else { | 891 } else { |
892 // We only come here when the first contact was within the root window. | 892 // We only come here when the first contact was within the root window. |
893 if (!target) { | 893 if (!target) { |
894 target = GetEventHandlerForPoint(event->location()); | 894 target = GetEventHandlerForPoint(event->location(), event->type()); |
895 if (!target) | 895 if (!target) |
896 return false; | 896 return false; |
897 } | 897 } |
898 | 898 |
899 ui::TouchEvent translated_event( | 899 ui::TouchEvent translated_event( |
900 *event, static_cast<Window*>(this), target); | 900 *event, static_cast<Window*>(this), target); |
901 status = ProcessTouchEvent(target, &translated_event); | 901 status = ProcessTouchEvent(target, &translated_event); |
902 handled = status != ui::TOUCH_STATUS_UNKNOWN; | 902 handled = status != ui::TOUCH_STATUS_UNKNOWN; |
903 | 903 |
904 if (status == ui::TOUCH_STATUS_QUEUED || | 904 if (status == ui::TOUCH_STATUS_QUEUED || |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 // RootWindow, private: | 959 // RootWindow, private: |
960 | 960 |
961 bool RootWindow::DispatchMouseEventImpl(ui::MouseEvent* event) { | 961 bool RootWindow::DispatchMouseEventImpl(ui::MouseEvent* event) { |
962 float scale = ui::GetDeviceScaleFactor(layer()); | 962 float scale = ui::GetDeviceScaleFactor(layer()); |
963 ui::Transform transform = layer()->transform(); | 963 ui::Transform transform = layer()->transform(); |
964 transform.ConcatScale(scale, scale); | 964 transform.ConcatScale(scale, scale); |
965 event->UpdateForRootTransform(transform); | 965 event->UpdateForRootTransform(transform); |
966 Window* target = mouse_pressed_handler_ ? | 966 Window* target = mouse_pressed_handler_ ? |
967 mouse_pressed_handler_ : client::GetCaptureWindow(this); | 967 mouse_pressed_handler_ : client::GetCaptureWindow(this); |
968 if (!target) | 968 if (!target) |
969 target = GetEventHandlerForPoint(event->location()); | 969 target = GetEventHandlerForPoint(event->location(), event->type()); |
970 return DispatchMouseEventToTarget(event, target); | 970 return DispatchMouseEventToTarget(event, target); |
971 } | 971 } |
972 | 972 |
973 bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, | 973 bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, |
974 Window* target) { | 974 Window* target) { |
975 static const int kMouseButtonFlagMask = | 975 static const int kMouseButtonFlagMask = |
976 ui::EF_LEFT_MOUSE_BUTTON | | 976 ui::EF_LEFT_MOUSE_BUTTON | |
977 ui::EF_MIDDLE_MOUSE_BUTTON | | 977 ui::EF_MIDDLE_MOUSE_BUTTON | |
978 ui::EF_RIGHT_MOUSE_BUTTON; | 978 ui::EF_RIGHT_MOUSE_BUTTON; |
979 SetLastMouseLocation(this, event->location()); | 979 SetLastMouseLocation(this, event->location()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 void RootWindow::UnlockCompositor() { | 1057 void RootWindow::UnlockCompositor() { |
1058 DCHECK(compositor_lock_); | 1058 DCHECK(compositor_lock_); |
1059 compositor_lock_ = NULL; | 1059 compositor_lock_ = NULL; |
1060 if (draw_on_compositor_unlock_) { | 1060 if (draw_on_compositor_unlock_) { |
1061 draw_on_compositor_unlock_ = false; | 1061 draw_on_compositor_unlock_ = false; |
1062 ScheduleDraw(); | 1062 ScheduleDraw(); |
1063 } | 1063 } |
1064 } | 1064 } |
1065 | 1065 |
1066 } // namespace aura | 1066 } // namespace aura |
OLD | NEW |