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

Unified Diff: ui/aura/root_window.cc

Issue 10919135: Move ash specific cursor code to CursorManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests and rebase Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/root_window.cc
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 3d0981f5bcb36cc8d92388b9564351a6525ab6ba..ed3d4c3449eb010fe25d0e3fa529340eb61ff156 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -15,7 +15,7 @@
#include "ui/aura/aura_switches.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/capture_client.h"
-#include "ui/aura/client/drag_drop_client.h"
+#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/event_client.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/display_manager.h"
@@ -110,8 +110,6 @@ void CompositorLock::CancelLock() {
root_window_ = NULL;
}
-bool RootWindow::hide_host_cursor_ = false;
-
RootWindow::CreateParams::CreateParams(const gfx::Rect& a_initial_bounds)
: initial_bounds(a_initial_bounds),
host(NULL) {
@@ -240,11 +238,6 @@ gfx::Point RootWindow::GetHostOrigin() const {
}
void RootWindow::SetCursor(gfx::NativeCursor cursor) {
- // If a drag is in progress, the DragDropClient should override the cursor.
- client::DragDropClient* dnd_client = client::GetDragDropClient(this);
- if (dnd_client && dnd_client->IsDragDropInProgress())
- cursor = dnd_client->GetDragCursor();
-
last_cursor_ = cursor;
// A lot of code seems to depend on NULL cursors actually showing an arrow,
// so just pass everything along to the host.
@@ -523,11 +516,20 @@ void RootWindow::OnCompositingAborted(ui::Compositor*) {
void RootWindow::OnDeviceScaleFactorChanged(
float device_scale_factor) {
- if (cursor_shown_)
+ const bool cursor_is_in_bounds =
+ GetBoundsInScreen().Contains(Env::GetInstance()->last_mouse_location());
+ if (cursor_is_in_bounds && cursor_shown_)
ShowCursor(false);
host_->OnDeviceScaleFactorChanged(device_scale_factor);
Window::OnDeviceScaleFactorChanged(device_scale_factor);
- if (cursor_shown_)
+ // Update the device scale factor of the cursor client only when the last
+ // mouse location is on this root window.
+ if (cursor_is_in_bounds) {
+ client::CursorClient* cursor_client = client::GetCursorClient(this);
+ if (cursor_client)
+ cursor_client->SetDeviceScaleFactor(device_scale_factor);
+ }
+ if (cursor_is_in_bounds && cursor_shown_)
ShowCursor(true);
}

Powered by Google App Engine
This is Rietveld 408576698