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

Unified Diff: ui/wm/core/cursor_manager.cc

Issue 1870743003: Ensure that the cursor visibility state is restored correctly on CursorManager creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/wm/core/cursor_manager.h ('k') | ui/wm/core/cursor_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/cursor_manager.cc
diff --git a/ui/wm/core/cursor_manager.cc b/ui/wm/core/cursor_manager.cc
index 51a30ac6f200ea32cd39dd5c08913fc78175e4f1..607614b61311860b889149d478a043c46755f5f3 100644
--- a/ui/wm/core/cursor_manager.cc
+++ b/ui/wm/core/cursor_manager.cc
@@ -73,11 +73,16 @@ class CursorState {
} // namespace internal
+bool CursorManager::last_cursor_visibility_state_ = true;
+
CursorManager::CursorManager(scoped_ptr<NativeCursorManager> delegate)
: delegate_(std::move(delegate)),
cursor_lock_count_(0),
current_state_(new internal::CursorState),
- state_on_unlock_(new internal::CursorState) {}
+ state_on_unlock_(new internal::CursorState) {
+ // Restore the last cursor visibility state.
+ current_state_->SetVisible(last_cursor_visibility_state_);
+}
CursorManager::~CursorManager() {
}
@@ -95,6 +100,7 @@ gfx::NativeCursor CursorManager::GetCursor() const {
}
void CursorManager::ShowCursor() {
+ last_cursor_visibility_state_ = true;
state_on_unlock_->SetVisible(true);
if (cursor_lock_count_ == 0 &&
IsCursorVisible() != state_on_unlock_->visible()) {
@@ -105,6 +111,7 @@ void CursorManager::ShowCursor() {
}
void CursorManager::HideCursor() {
+ last_cursor_visibility_state_ = false;
state_on_unlock_->SetVisible(false);
if (cursor_lock_count_ == 0 &&
IsCursorVisible() != state_on_unlock_->visible()) {
« no previous file with comments | « ui/wm/core/cursor_manager.h ('k') | ui/wm/core/cursor_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698