| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void RootWindow::OnMouseEventsEnableStateChanged(bool enabled) { | 284 void RootWindow::OnMouseEventsEnableStateChanged(bool enabled) { |
| 285 // Send entered / exited so that visual state can be updated to match | 285 // Send entered / exited so that visual state can be updated to match |
| 286 // mouse events state. | 286 // mouse events state. |
| 287 PostMouseMoveEventAfterWindowChange(); | 287 PostMouseMoveEventAfterWindowChange(); |
| 288 // TODO(mazda): Add code to disable mouse events when |enabled| == false. | 288 // TODO(mazda): Add code to disable mouse events when |enabled| == false. |
| 289 } | 289 } |
| 290 | 290 |
| 291 void RootWindow::MoveCursorTo(const gfx::Point& location_in_dip) { | 291 void RootWindow::MoveCursorTo(const gfx::Point& location_in_dip) { |
| 292 gfx::Point3F point_3f(location_in_dip); | 292 gfx::Point location(location_in_dip); |
| 293 GetRootTransform().TransformPoint(point_3f); | 293 ConvertPointToHost(&location); |
| 294 host_->MoveCursorTo(gfx::ToFlooredPoint(point_3f.AsPointF())); | 294 host_->MoveCursorTo(location); |
| 295 SetLastMouseLocation(this, location_in_dip); | 295 SetLastMouseLocation(this, location_in_dip); |
| 296 client::CursorClient* cursor_client = client::GetCursorClient(this); | 296 client::CursorClient* cursor_client = client::GetCursorClient(this); |
| 297 if (cursor_client) { | 297 if (cursor_client) { |
| 298 const gfx::Display& display = | 298 const gfx::Display& display = |
| 299 gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(this); | 299 gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(this); |
| 300 cursor_client->SetDisplay(display); | 300 cursor_client->SetDisplay(display); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 void RootWindow::MoveCursorToHostLoation(const gfx::Point& host_location) { |
| 305 host_->MoveCursorTo(host_location); |
| 306 gfx::Point root_location(host_location); |
| 307 ConvertPointFromHost(&root_location); |
| 308 SetLastMouseLocation(this, root_location); |
| 309 client::CursorClient* cursor_client = client::GetCursorClient(this); |
| 310 if (cursor_client) { |
| 311 const gfx::Display& display = |
| 312 gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(this); |
| 313 cursor_client->SetDisplay(display); |
| 314 } |
| 315 |
| 316 synthesize_mouse_move_ = false; |
| 317 } |
| 318 |
| 304 bool RootWindow::ConfineCursorToWindow() { | 319 bool RootWindow::ConfineCursorToWindow() { |
| 305 // We would like to be able to confine the cursor to that window. However, | 320 // We would like to be able to confine the cursor to that window. However, |
| 306 // currently, we do not have such functionality in X. So we just confine | 321 // currently, we do not have such functionality in X. So we just confine |
| 307 // to the root window. This is ok because this option is currently only | 322 // to the root window. This is ok because this option is currently only |
| 308 // being used in fullscreen mode, so root_window bounds = window bounds. | 323 // being used in fullscreen mode, so root_window bounds = window bounds. |
| 309 return host_->ConfineCursorToRootWindow(); | 324 return host_->ConfineCursorToRootWindow(); |
| 310 } | 325 } |
| 311 | 326 |
| 312 void RootWindow::Draw() { | 327 void RootWindow::Draw() { |
| 313 defer_draw_scheduling_ = false; | 328 defer_draw_scheduling_ = false; |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 } | 1180 } |
| 1166 | 1181 |
| 1167 gfx::Transform RootWindow::GetInverseRootTransform() const { | 1182 gfx::Transform RootWindow::GetInverseRootTransform() const { |
| 1168 float scale = ui::GetDeviceScaleFactor(layer()); | 1183 float scale = ui::GetDeviceScaleFactor(layer()); |
| 1169 gfx::Transform transform; | 1184 gfx::Transform transform; |
| 1170 transform.Scale(1.0f / scale, 1.0f / scale); | 1185 transform.Scale(1.0f / scale, 1.0f / scale); |
| 1171 return transformer_->GetInverseTransform() * transform; | 1186 return transformer_->GetInverseTransform() * transform; |
| 1172 } | 1187 } |
| 1173 | 1188 |
| 1174 } // namespace aura | 1189 } // namespace aura |
| OLD | NEW |