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