diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-11 20:18:35 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-11 20:18:35 +0000 |
commit | 151ffdff429adc13dea9afbe18602745981a9dcc (patch) | |
tree | 65ea7ff184d3e543d2a6213e29a96119eed4081b /ui/aura/root_window.cc | |
parent | 843fe4276bb2a001d6bdbb74dda7ef44a707cec7 (diff) | |
download | chromium_src-151ffdff429adc13dea9afbe18602745981a9dcc.zip chromium_src-151ffdff429adc13dea9afbe18602745981a9dcc.tar.gz chromium_src-151ffdff429adc13dea9afbe18602745981a9dcc.tar.bz2 |
Move ash specific cursor code to CursorManager.
Main changes are as follows.
- Move the responsibility of managing cursors to ash::CursorManager from aura::RootWindowHostLinux.
- Set the same cursor to all root windows with CursorManager so that cursor is updated properly while dragging across displays
- Introduce CursorLoader class, which implements platform specific cursor loading.
- Add SetDeviceScaleFactor to CursorClient, which sets the device scale factor used for the cursor.
BUG=132862,144756
Review URL: https://chromiumcodereview.appspot.com/10919135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/root_window.cc')
-rw-r--r-- | ui/aura/root_window.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 7662cfe..b261a2a 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) { @@ -246,11 +244,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. @@ -529,11 +522,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); } |