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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
664 mouse_pressed_handler_ = NULL; | 664 mouse_pressed_handler_ = NULL; |
665 mouse_moved_handler_ = NULL; | 665 mouse_moved_handler_ = NULL; |
666 mouse_event_dispatch_target_ = NULL; | 666 mouse_event_dispatch_target_ = NULL; |
667 } | 667 } |
668 | 668 |
669 //////////////////////////////////////////////////////////////////////////////// | 669 //////////////////////////////////////////////////////////////////////////////// |
670 // RootWindow, private: | 670 // RootWindow, private: |
671 | 671 |
672 void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) { | 672 void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) { |
673 event->UpdateForRootTransform(GetRootTransform()); | 673 event->UpdateForRootTransform(GetRootTransform()); |
674 #if defined(OS_CHROMEOS) | |
oshima
2013/03/20 20:52:53
I put inside ifdef to avoid potential issues on wi
| |
675 const gfx::Rect& root_bounds = bounds(); | |
676 if (host_->GetBounds().Contains(event->system_location()) && | |
677 !root_bounds.Contains(event->root_location())) { | |
678 // Make sure that the mouse location inside the host window gets | |
679 // translated inside root window. | |
680 // TODO(oshima): This is (hopefully) short term bandaid to deal | |
681 // with calculation error in inverted matrix. We'll try better | |
682 // alternative (crbug.com/222483) for m28. | |
683 int x = event->location().x(); | |
684 int y = event->location().y(); | |
685 x = std::min(std::max(x, root_bounds.x()), root_bounds.right()); | |
686 y = std::min(std::max(y, root_bounds.y()), root_bounds.bottom()); | |
687 const gfx::Point new_location(x, y); | |
688 event->set_location(new_location); | |
689 event->set_root_location(new_location); | |
690 } | |
691 #endif // defined(OS_CHROMEOS) | |
674 } | 692 } |
675 | 693 |
676 void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) { | 694 void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) { |
677 if (target == mouse_moved_handler_) | 695 if (target == mouse_moved_handler_) |
678 return; | 696 return; |
679 | 697 |
680 DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); | 698 DispatchMouseEnterOrExit(event, ui::ET_MOUSE_EXITED); |
681 | 699 |
682 if (mouse_event_dispatch_target_ != target) { | 700 if (mouse_event_dispatch_target_ != target) { |
683 mouse_moved_handler_ = NULL; | 701 mouse_moved_handler_ = NULL; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1153 | 1171 |
1154 gfx::Transform RootWindow::GetRootTransform() const { | 1172 gfx::Transform RootWindow::GetRootTransform() const { |
1155 float scale = ui::GetDeviceScaleFactor(layer()); | 1173 float scale = ui::GetDeviceScaleFactor(layer()); |
1156 gfx::Transform transform; | 1174 gfx::Transform transform; |
1157 transform.Scale(scale, scale); | 1175 transform.Scale(scale, scale); |
1158 transform *= layer()->transform(); | 1176 transform *= layer()->transform(); |
1159 return transform; | 1177 return transform; |
1160 } | 1178 } |
1161 | 1179 |
1162 } // namespace aura | 1180 } // namespace aura |
OLD | NEW |