| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // RootWindow, Window overrides: | 462 // RootWindow, Window overrides: |
| 463 | 463 |
| 464 RootWindow* RootWindow::GetRootWindow() { | 464 RootWindow* RootWindow::GetRootWindow() { |
| 465 return this; | 465 return this; |
| 466 } | 466 } |
| 467 | 467 |
| 468 const RootWindow* RootWindow::GetRootWindow() const { | 468 const RootWindow* RootWindow::GetRootWindow() const { |
| 469 return this; | 469 return this; |
| 470 } | 470 } |
| 471 | 471 |
| 472 void RootWindow::SetTransform(const ui::Transform& transform) { | 472 void RootWindow::SetTransform(const gfx::Transform& transform) { |
| 473 Window::SetTransform(transform); | 473 Window::SetTransform(transform); |
| 474 | 474 |
| 475 // If the layer is not animating, then we need to update the host size | 475 // If the layer is not animating, then we need to update the host size |
| 476 // immediately. | 476 // immediately. |
| 477 if (!layer()->GetAnimator()->is_animating()) | 477 if (!layer()->GetAnimator()->is_animating()) |
| 478 OnHostResized(host_->GetBounds().size()); | 478 OnHostResized(host_->GetBounds().size()); |
| 479 } | 479 } |
| 480 | 480 |
| 481 //////////////////////////////////////////////////////////////////////////////// | 481 //////////////////////////////////////////////////////////////////////////////// |
| 482 // RootWindow, ui::EventTarget implementation: | 482 // RootWindow, ui::EventTarget implementation: |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 held_mouse_move_.reset(); | 828 held_mouse_move_.reset(); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 DispatchHeldMouseMove(); | 831 DispatchHeldMouseMove(); |
| 832 return DispatchMouseEventImpl(event); | 832 return DispatchMouseEventImpl(event); |
| 833 } | 833 } |
| 834 | 834 |
| 835 bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) { | 835 bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) { |
| 836 DispatchHeldMouseMove(); | 836 DispatchHeldMouseMove(); |
| 837 float scale = ui::GetDeviceScaleFactor(layer()); | 837 float scale = ui::GetDeviceScaleFactor(layer()); |
| 838 ui::Transform transform = layer()->transform(); | 838 gfx::Transform transform = layer()->transform(); |
| 839 transform.ConcatScale(scale, scale); | 839 transform.ConcatScale(scale, scale); |
| 840 event->UpdateForRootTransform(transform); | 840 event->UpdateForRootTransform(transform); |
| 841 | 841 |
| 842 SetLastMouseLocation(this, event->location()); | 842 SetLastMouseLocation(this, event->location()); |
| 843 synthesize_mouse_move_ = false; | 843 synthesize_mouse_move_ = false; |
| 844 | 844 |
| 845 Window* target = mouse_pressed_handler_ ? | 845 Window* target = mouse_pressed_handler_ ? |
| 846 mouse_pressed_handler_ : client::GetCaptureWindow(this); | 846 mouse_pressed_handler_ : client::GetCaptureWindow(this); |
| 847 if (!target) | 847 if (!target) |
| 848 target = GetEventHandlerForPoint(event->location()); | 848 target = GetEventHandlerForPoint(event->location()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 872 case ui::ET_TOUCH_RELEASED: | 872 case ui::ET_TOUCH_RELEASED: |
| 873 touch_ids_down_ = (touch_ids_down_ | (1 << event->touch_id())) ^ | 873 touch_ids_down_ = (touch_ids_down_ | (1 << event->touch_id())) ^ |
| 874 (1 << event->touch_id()); | 874 (1 << event->touch_id()); |
| 875 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); | 875 Env::GetInstance()->set_touch_down(touch_ids_down_ != 0); |
| 876 break; | 876 break; |
| 877 | 877 |
| 878 default: | 878 default: |
| 879 break; | 879 break; |
| 880 } | 880 } |
| 881 float scale = ui::GetDeviceScaleFactor(layer()); | 881 float scale = ui::GetDeviceScaleFactor(layer()); |
| 882 ui::Transform transform = layer()->transform(); | 882 gfx::Transform transform = layer()->transform(); |
| 883 transform.ConcatScale(scale, scale); | 883 transform.ConcatScale(scale, scale); |
| 884 event->UpdateForRootTransform(transform); | 884 event->UpdateForRootTransform(transform); |
| 885 bool handled = false; | 885 bool handled = false; |
| 886 ui::EventResult result = ui::ER_UNHANDLED; | 886 ui::EventResult result = ui::ER_UNHANDLED; |
| 887 Window* target = client::GetCaptureWindow(this); | 887 Window* target = client::GetCaptureWindow(this); |
| 888 if (!target) { | 888 if (!target) { |
| 889 target = ConsumerToWindow( | 889 target = ConsumerToWindow( |
| 890 gesture_recognizer_->GetTouchLockedTarget(event)); | 890 gesture_recognizer_->GetTouchLockedTarget(event)); |
| 891 if (!target) { | 891 if (!target) { |
| 892 target = ConsumerToWindow( | 892 target = ConsumerToWindow( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 | 963 |
| 964 RootWindow* RootWindow::AsRootWindow() { | 964 RootWindow* RootWindow::AsRootWindow() { |
| 965 return this; | 965 return this; |
| 966 } | 966 } |
| 967 | 967 |
| 968 //////////////////////////////////////////////////////////////////////////////// | 968 //////////////////////////////////////////////////////////////////////////////// |
| 969 // RootWindow, private: | 969 // RootWindow, private: |
| 970 | 970 |
| 971 bool RootWindow::DispatchMouseEventImpl(ui::MouseEvent* event) { | 971 bool RootWindow::DispatchMouseEventImpl(ui::MouseEvent* event) { |
| 972 float scale = ui::GetDeviceScaleFactor(layer()); | 972 float scale = ui::GetDeviceScaleFactor(layer()); |
| 973 ui::Transform transform = layer()->transform(); | 973 gfx::Transform transform = layer()->transform(); |
| 974 transform.ConcatScale(scale, scale); | 974 transform.ConcatScale(scale, scale); |
| 975 event->UpdateForRootTransform(transform); | 975 event->UpdateForRootTransform(transform); |
| 976 Window* target = mouse_pressed_handler_ ? | 976 Window* target = mouse_pressed_handler_ ? |
| 977 mouse_pressed_handler_ : client::GetCaptureWindow(this); | 977 mouse_pressed_handler_ : client::GetCaptureWindow(this); |
| 978 if (!target) | 978 if (!target) |
| 979 target = GetEventHandlerForPoint(event->location()); | 979 target = GetEventHandlerForPoint(event->location()); |
| 980 return DispatchMouseEventToTarget(event, target); | 980 return DispatchMouseEventToTarget(event, target); |
| 981 } | 981 } |
| 982 | 982 |
| 983 bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, | 983 bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 event_factory_.GetWeakPtr())); | 1040 event_factory_.GetWeakPtr())); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 void RootWindow::SynthesizeMouseMoveEvent() { | 1043 void RootWindow::SynthesizeMouseMoveEvent() { |
| 1044 if (!synthesize_mouse_move_) | 1044 if (!synthesize_mouse_move_) |
| 1045 return; | 1045 return; |
| 1046 synthesize_mouse_move_ = false; | 1046 synthesize_mouse_move_ = false; |
| 1047 #if !defined(OS_WIN) | 1047 #if !defined(OS_WIN) |
| 1048 // Temporarily disabled for windows. See crbug.com/112222. | 1048 // Temporarily disabled for windows. See crbug.com/112222. |
| 1049 gfx::Point3f point(GetLastMouseLocationInRoot()); | 1049 gfx::Point3f point(GetLastMouseLocationInRoot()); |
| 1050 ui::Transform transform = layer()->transform(); | 1050 gfx::Transform transform = layer()->transform(); |
| 1051 float scale = ui::GetDeviceScaleFactor(layer()); | 1051 float scale = ui::GetDeviceScaleFactor(layer()); |
| 1052 transform.ConcatScale(scale, scale); | 1052 transform.ConcatScale(scale, scale); |
| 1053 transform.TransformPoint(point); | 1053 transform.TransformPoint(point); |
| 1054 gfx::Point orig_mouse_location = point.AsPoint(); | 1054 gfx::Point orig_mouse_location = point.AsPoint(); |
| 1055 | 1055 |
| 1056 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's | 1056 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's |
| 1057 // currently broken. See/ crbug.com/107931. | 1057 // currently broken. See/ crbug.com/107931. |
| 1058 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1058 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
| 1059 orig_mouse_location, | 1059 orig_mouse_location, |
| 1060 orig_mouse_location, | 1060 orig_mouse_location, |
| 1061 ui::EF_IS_SYNTHESIZED); | 1061 ui::EF_IS_SYNTHESIZED); |
| 1062 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1062 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
| 1063 OnHostMouseEvent(&event); | 1063 OnHostMouseEvent(&event); |
| 1064 #endif | 1064 #endif |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 void RootWindow::UnlockCompositor() { | 1067 void RootWindow::UnlockCompositor() { |
| 1068 DCHECK(compositor_lock_); | 1068 DCHECK(compositor_lock_); |
| 1069 compositor_lock_ = NULL; | 1069 compositor_lock_ = NULL; |
| 1070 if (draw_on_compositor_unlock_) { | 1070 if (draw_on_compositor_unlock_) { |
| 1071 draw_on_compositor_unlock_ = false; | 1071 draw_on_compositor_unlock_ = false; |
| 1072 ScheduleDraw(); | 1072 ScheduleDraw(); |
| 1073 } | 1073 } |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 } // namespace aura | 1076 } // namespace aura |
| OLD | NEW |