summaryrefslogtreecommitdiffstats
path: root/ash/wm/cursor_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ash/wm/cursor_manager.cc')
-rw-r--r--ash/wm/cursor_manager.cc24
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(&current_cursor_);
+ current_cursor_.set_device_scale_factor(
+ image_cursors_->GetDeviceScaleFactor());
+ delegate_->SetCursor(current_cursor_);
+}
+
} // namespace ash