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

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: addressed comments 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
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 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);
oshima 2013/04/25 14:58:13 Sorry if I wasn't clear. Can you refactor this met
yoshiki 2013/04/25 16:05:19 We can't use MoveCursorToHostLoation from MoveCurs
oshima 2013/04/25 16:09:02 I think we should set this in both cases.
yoshiki 2013/04/25 16:23:27 Done. Moved 'synthesize_mouse_move_ = false' to Mo
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);
sky 2013/04/25 14:41:35 Shouldn't moving the cursor trigger all of the fol
oshima 2013/04/25 14:58:13 Yes, but asynchronously. My understanding is that
yoshiki 2013/04/25 16:05:19 Right, I want to move the cursor synchronously.
sky 2013/04/25 16:46:59 Why is it important that the mouse is synchronous?
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
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
OLDNEW
« ash/magnifier/magnification_controller.h ('K') | « ui/aura/root_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698