| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 gfx::Point point; | 581 gfx::Point point; |
| 582 host_->QueryMouseLocation(&point); | 582 host_->QueryMouseLocation(&point); |
| 583 return point; | 583 return point; |
| 584 } | 584 } |
| 585 | 585 |
| 586 //////////////////////////////////////////////////////////////////////////////// | 586 //////////////////////////////////////////////////////////////////////////////// |
| 587 // RootWindow, private: | 587 // RootWindow, private: |
| 588 | 588 |
| 589 void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) { | 589 void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) { |
| 590 float scale = ui::GetDeviceScaleFactor(layer()); | 590 float scale = ui::GetDeviceScaleFactor(layer()); |
| 591 gfx::Transform transform = layer()->transform(); | 591 gfx::Transform transform; |
| 592 transform.ConcatScale(scale, scale); | 592 transform.Scale(scale, scale); |
| 593 transform *= layer()->transform(); |
| 593 event->UpdateForRootTransform(transform); | 594 event->UpdateForRootTransform(transform); |
| 594 } | 595 } |
| 595 | 596 |
| 596 void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) { | 597 void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) { |
| 597 if (target == mouse_moved_handler_) | 598 if (target == mouse_moved_handler_) |
| 598 return; | 599 return; |
| 599 | 600 |
| 600 // Send an exited event. | 601 // Send an exited event. |
| 601 if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { | 602 if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { |
| 602 ui::MouseEvent translated_event(event, | 603 ui::MouseEvent translated_event(event, |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 event_factory_.GetWeakPtr())); | 1026 event_factory_.GetWeakPtr())); |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 void RootWindow::SynthesizeMouseMoveEvent() { | 1029 void RootWindow::SynthesizeMouseMoveEvent() { |
| 1029 if (!synthesize_mouse_move_) | 1030 if (!synthesize_mouse_move_) |
| 1030 return; | 1031 return; |
| 1031 synthesize_mouse_move_ = false; | 1032 synthesize_mouse_move_ = false; |
| 1032 #if !defined(OS_WIN) | 1033 #if !defined(OS_WIN) |
| 1033 // Temporarily disabled for windows. See crbug.com/112222. | 1034 // Temporarily disabled for windows. See crbug.com/112222. |
| 1034 gfx::Point3F point(GetLastMouseLocationInRoot()); | 1035 gfx::Point3F point(GetLastMouseLocationInRoot()); |
| 1035 gfx::Transform transform = layer()->transform(); | |
| 1036 float scale = ui::GetDeviceScaleFactor(layer()); | 1036 float scale = ui::GetDeviceScaleFactor(layer()); |
| 1037 transform.ConcatScale(scale, scale); | 1037 gfx::Transform transform; |
| 1038 transform.Scale(scale, scale); |
| 1039 transform *= layer()->transform(); |
| 1038 transform.TransformPoint(point); | 1040 transform.TransformPoint(point); |
| 1039 gfx::Point orig_mouse_location = gfx::ToFlooredPoint(point.AsPointF()); | 1041 gfx::Point orig_mouse_location = gfx::ToFlooredPoint(point.AsPointF()); |
| 1040 | 1042 |
| 1041 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's | 1043 // TODO(derat|oshima): Don't use mouse_button_flags_ as it's |
| 1042 // currently broken. See/ crbug.com/107931. | 1044 // currently broken. See/ crbug.com/107931. |
| 1043 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1045 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
| 1044 orig_mouse_location, | 1046 orig_mouse_location, |
| 1045 orig_mouse_location, | 1047 orig_mouse_location, |
| 1046 ui::EF_IS_SYNTHESIZED); | 1048 ui::EF_IS_SYNTHESIZED); |
| 1047 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1049 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
| 1048 OnHostMouseEvent(&event); | 1050 OnHostMouseEvent(&event); |
| 1049 #endif | 1051 #endif |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 } // namespace aura | 1054 } // namespace aura |
| OLD | NEW |