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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc

Issue 92413002: Cursor state should be global for all CursorManagers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 7 years 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/views/widget/desktop_aura/desktop_native_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/views/widget/desktop_aura/desktop_native_cursor_manager.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h"
6 6
7 #include "ui/aura/root_window.h" 7 #include "ui/aura/root_window.h"
8 #include "ui/base/cursor/cursor_loader.h" 8 #include "ui/base/cursor/cursor_loader.h"
9 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" 9 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h"
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 void DesktopNativeCursorManager::SetDisplay( 32 void DesktopNativeCursorManager::SetDisplay(
33 const gfx::Display& display, 33 const gfx::Display& display,
34 views::corewm::NativeCursorManagerDelegate* delegate) { 34 views::corewm::NativeCursorManagerDelegate* delegate) {
35 cursor_loader_->UnloadAll(); 35 cursor_loader_->UnloadAll();
36 cursor_loader_->set_display(display); 36 cursor_loader_->set_display(display);
37 37
38 if (cursor_loader_updater_.get()) 38 if (cursor_loader_updater_.get())
39 cursor_loader_updater_->OnDisplayUpdated(display, cursor_loader_.get()); 39 cursor_loader_updater_->OnDisplayUpdated(display, cursor_loader_.get());
40 40
41 SetCursor(delegate->GetCurrentCursor(), delegate); 41 SetCursor(delegate->GetCursor(), delegate);
42 } 42 }
43 43
44 void DesktopNativeCursorManager::SetCursor( 44 void DesktopNativeCursorManager::SetCursor(
45 gfx::NativeCursor cursor, 45 gfx::NativeCursor cursor,
46 views::corewm::NativeCursorManagerDelegate* delegate) { 46 views::corewm::NativeCursorManagerDelegate* delegate) {
47 gfx::NativeCursor new_cursor = cursor; 47 gfx::NativeCursor new_cursor = cursor;
48 cursor_loader_->SetPlatformCursor(&new_cursor); 48 cursor_loader_->SetPlatformCursor(&new_cursor);
49 delegate->CommitCursor(new_cursor); 49 delegate->CommitCursor(new_cursor);
50 50
51 if (delegate->GetCurrentVisibility()) 51 if (delegate->IsCursorVisible())
52 root_window_->SetCursor(new_cursor); 52 root_window_->SetCursor(new_cursor);
53 } 53 }
54 54
55 void DesktopNativeCursorManager::SetVisibility( 55 void DesktopNativeCursorManager::SetVisibility(
56 bool visible, 56 bool visible,
57 views::corewm::NativeCursorManagerDelegate* delegate) { 57 views::corewm::NativeCursorManagerDelegate* delegate) {
58 delegate->CommitVisibility(visible); 58 delegate->CommitVisibility(visible);
59 59
60 if (visible) { 60 if (visible) {
61 SetCursor(delegate->GetCurrentCursor(), delegate); 61 SetCursor(delegate->GetCursor(), delegate);
62 } else { 62 } else {
63 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 63 gfx::NativeCursor invisible_cursor(ui::kCursorNone);
64 cursor_loader_->SetPlatformCursor(&invisible_cursor); 64 cursor_loader_->SetPlatformCursor(&invisible_cursor);
65 root_window_->SetCursor(invisible_cursor); 65 root_window_->SetCursor(invisible_cursor);
66 } 66 }
67 67
68 root_window_->OnCursorVisibilityChanged(visible); 68 root_window_->OnCursorVisibilityChanged(visible);
69 } 69 }
70 70
71 void DesktopNativeCursorManager::SetCursorSet( 71 void DesktopNativeCursorManager::SetCursorSet(
72 ui::CursorSetType cursor_set, 72 ui::CursorSetType cursor_set,
73 views::corewm::NativeCursorManagerDelegate* delegate) { 73 views::corewm::NativeCursorManagerDelegate* delegate) {
74 NOTIMPLEMENTED(); 74 NOTIMPLEMENTED();
75 } 75 }
76 76
77 void DesktopNativeCursorManager::SetScale( 77 void DesktopNativeCursorManager::SetScale(
78 float scale, 78 float scale,
79 views::corewm::NativeCursorManagerDelegate* delegate) { 79 views::corewm::NativeCursorManagerDelegate* delegate) {
80 NOTIMPLEMENTED(); 80 NOTIMPLEMENTED();
81 } 81 }
82 82
83 void DesktopNativeCursorManager::SetMouseEventsEnabled( 83 void DesktopNativeCursorManager::SetMouseEventsEnabled(
84 bool enabled, 84 bool enabled,
85 views::corewm::NativeCursorManagerDelegate* delegate) { 85 views::corewm::NativeCursorManagerDelegate* delegate) {
86 delegate->CommitMouseEventsEnabled(enabled); 86 delegate->CommitMouseEventsEnabled(enabled);
87 87
88 // TODO(erg): In the ash version, we set the last mouse location on Env. I'm 88 // TODO(erg): In the ash version, we set the last mouse location on Env. I'm
89 // not sure this concept makes sense on the desktop. 89 // not sure this concept makes sense on the desktop.
90 90
91 SetVisibility(delegate->GetCurrentVisibility(), delegate); 91 SetVisibility(delegate->IsCursorVisible(), delegate);
92 92
93 root_window_->OnMouseEventsEnableStateChanged(enabled); 93 root_window_->OnMouseEventsEnableStateChanged(enabled);
94 } 94 }
95 95
96 } // namespace views 96 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_cursor_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698