Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: ui/aura/root_window.cc

Issue 13947045: Magnifier: Move the cursor directly to the root window host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a misspelling and add a comment Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 host_location(location_in_dip);
293 GetRootTransform().TransformPoint(point_3f); 293 ConvertPointToHost(&host_location);
294 host_->MoveCursorTo(gfx::ToFlooredPoint(point_3f.AsPointF())); 294 MoveCursorToInternal(location_in_dip, host_location);
295 SetLastMouseLocation(this, location_in_dip); 295 }
296
297 void RootWindow::MoveCursorToHostLocation(const gfx::Point& host_location) {
298 gfx::Point root_location(host_location);
299 ConvertPointFromHost(&root_location);
300 MoveCursorToInternal(root_location, host_location);
301 }
302
303 void RootWindow::MoveCursorToInternal(
sky 2013/04/25 18:16:24 Make position match header, and when you wrap each
yoshiki 2013/04/25 18:46:40 Done.
304 const gfx::Point& root_location, const gfx::Point& host_location) {
305 host_->MoveCursorTo(host_location);
306 SetLastMouseLocation(this, root_location);
296 client::CursorClient* cursor_client = client::GetCursorClient(this); 307 client::CursorClient* cursor_client = client::GetCursorClient(this);
297 if (cursor_client) { 308 if (cursor_client) {
298 const gfx::Display& display = 309 const gfx::Display& display =
299 gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(this); 310 gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(this);
300 cursor_client->SetDisplay(display); 311 cursor_client->SetDisplay(display);
301 } 312 }
313 synthesize_mouse_move_ = false;
302 } 314 }
303 315
304 bool RootWindow::ConfineCursorToWindow() { 316 bool RootWindow::ConfineCursorToWindow() {
305 // We would like to be able to confine the cursor to that window. However, 317 // 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 318 // 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 319 // 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. 320 // being used in fullscreen mode, so root_window bounds = window bounds.
309 return host_->ConfineCursorToRootWindow(); 321 return host_->ConfineCursorToRootWindow();
310 } 322 }
311 323
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 } 1177 }
1166 1178
1167 gfx::Transform RootWindow::GetInverseRootTransform() const { 1179 gfx::Transform RootWindow::GetInverseRootTransform() const {
1168 float scale = ui::GetDeviceScaleFactor(layer()); 1180 float scale = ui::GetDeviceScaleFactor(layer());
1169 gfx::Transform transform; 1181 gfx::Transform transform;
1170 transform.Scale(1.0f / scale, 1.0f / scale); 1182 transform.Scale(1.0f / scale, 1.0f / scale);
1171 return transformer_->GetInverseTransform() * transform; 1183 return transformer_->GetInverseTransform() * transform;
1172 } 1184 }
1173 1185
1174 } // namespace aura 1186 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698