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 /ash/wm/cursor_manager.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 'ash/wm/cursor_manager.cc')
-rw-r--r-- | ash/wm/cursor_manager.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/ash/wm/cursor_manager.cc b/ash/wm/cursor_manager.cc index 1ebc72b..3afee4b 100644 --- a/ash/wm/cursor_manager.cc +++ b/ash/wm/cursor_manager.cc @@ -5,8 +5,10 @@ #include "ash/wm/cursor_manager.h" #include "ash/wm/cursor_delegate.h" +#include "ash/wm/image_cursors.h" #include "base/logging.h" #include "ui/aura/env.h" +#include "ui/base/cursor/cursor.h" namespace ash { @@ -15,7 +17,9 @@ CursorManager::CursorManager() cursor_lock_count_(0), did_cursor_change_(false), cursor_to_set_on_unlock_(0), - cursor_visible_(true) { + cursor_visible_(true), + current_cursor_(ui::kCursorNone), + image_cursors_(new ImageCursors) { } CursorManager::~CursorManager() { @@ -42,7 +46,7 @@ void CursorManager::UnlockCursor() { void CursorManager::SetCursor(gfx::NativeCursor cursor) { if (cursor_lock_count_ == 0) { if (delegate_) - delegate_->SetCursor(cursor); + SetCursorInternal(cursor); } else { cursor_to_set_on_unlock_ = cursor; did_cursor_change_ = true; @@ -59,4 +63,20 @@ bool CursorManager::IsCursorVisible() const { return cursor_visible_; } +void CursorManager::SetDeviceScaleFactor(float device_scale_factor) { + if (image_cursors_->GetDeviceScaleFactor() == device_scale_factor) + return; + image_cursors_->SetDeviceScaleFactor(device_scale_factor); + SetCursorInternal(current_cursor_); +} + +void CursorManager::SetCursorInternal(gfx::NativeCursor cursor) { + DCHECK(delegate_); + current_cursor_ = cursor; + image_cursors_->SetPlatformCursor(¤t_cursor_); + current_cursor_.set_device_scale_factor( + image_cursors_->GetDeviceScaleFactor()); + delegate_->SetCursor(current_cursor_); +} + } // namespace ash |