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

Side by Side Diff: ui/aura/cursor_manager.cc

Issue 10826005: Don't warp mouse if the cursor is locked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/cursor_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/cursor_manager.h" 5 #include "ui/aura/cursor_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/aura/cursor_delegate.h" 8 #include "ui/aura/cursor_delegate.h"
9 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
10 10
11 namespace aura { 11 namespace aura {
12 12
13 CursorManager::CursorManager() 13 CursorManager::CursorManager()
14 : delegate_(NULL), 14 : delegate_(NULL),
15 cursor_lock_count_(0), 15 cursor_lock_count_(0),
16 did_cursor_change_(false), 16 did_cursor_change_(false),
17 cursor_to_set_on_unlock_(0), 17 cursor_to_set_on_unlock_(0),
18 cursor_visible_(true) { 18 cursor_visible_(true) {
19 } 19 }
20 20
21 CursorManager::~CursorManager() { 21 CursorManager::~CursorManager() {
22 } 22 }
23 23
24 void CursorManager::LockCursor() { 24 void CursorManager::LockCursor() {
25 cursor_lock_count_++; 25 cursor_lock_count_++;
26 } 26 }
27 27
28 bool CursorManager::IsCursorLocked() {
sky 2012/07/25 04:29:47 const and inline it.
oshima 2012/07/25 05:33:35 Done.
29 return cursor_lock_count_ > 0;
30 }
31
28 void CursorManager::UnlockCursor() { 32 void CursorManager::UnlockCursor() {
29 cursor_lock_count_--; 33 cursor_lock_count_--;
30 DCHECK_GE(cursor_lock_count_, 0); 34 DCHECK_GE(cursor_lock_count_, 0);
31 if (cursor_lock_count_ == 0) { 35 if (cursor_lock_count_ == 0) {
32 if (did_cursor_change_) { 36 if (did_cursor_change_) {
33 did_cursor_change_ = false; 37 did_cursor_change_ = false;
34 if (delegate_) 38 if (delegate_)
35 delegate_->SetCursor(cursor_to_set_on_unlock_); 39 delegate_->SetCursor(cursor_to_set_on_unlock_);
36 } 40 }
37 did_cursor_change_ = false; 41 did_cursor_change_ = false;
(...skipping 11 matching lines...) Expand all
49 } 53 }
50 } 54 }
51 55
52 void CursorManager::ShowCursor(bool show) { 56 void CursorManager::ShowCursor(bool show) {
53 cursor_visible_ = show; 57 cursor_visible_ = show;
54 if (delegate_) 58 if (delegate_)
55 delegate_->ShowCursor(show); 59 delegate_->ShowCursor(show);
56 } 60 }
57 61
58 } // namespace aura 62 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/cursor_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698