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

Side by Side Diff: components/exo/wm_helper_ash.cc

Issue 2780623002: exo: Fix multi-display hardware cursor (Closed)
Patch Set: Rebase properly Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/exo/wm_helper_ash.h" 5 #include "components/exo/wm_helper_ash.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/system/tray/system_tray_notifier.h" 8 #include "ash/common/system/tray/system_tray_notifier.h"
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/wm/ash_native_cursor_manager.h"
11 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
12 #include "ui/aura/client/focus_client.h" 14 #include "ui/aura/client/focus_client.h"
13 #include "ui/display/manager/display_manager.h" 15 #include "ui/display/manager/display_manager.h"
14 #include "ui/events/devices/device_data_manager.h" 16 #include "ui/events/devices/device_data_manager.h"
15 #include "ui/wm/public/activation_client.h" 17 #include "ui/wm/public/activation_client.h"
16 18
17 namespace exo { 19 namespace exo {
18 20
19 //////////////////////////////////////////////////////////////////////////////// 21 ////////////////////////////////////////////////////////////////////////////////
20 // WMHelperAsh, public: 22 // WMHelperAsh, public:
21 23
22 WMHelperAsh::WMHelperAsh() { 24 WMHelperAsh::WMHelperAsh() {
23 ash::Shell::GetInstance()->AddShellObserver(this); 25 ash::Shell::GetInstance()->AddShellObserver(this);
24 ash::Shell::GetInstance()->activation_client()->AddObserver(this); 26 ash::Shell::GetInstance()->activation_client()->AddObserver(this);
25 ash::Shell::GetInstance()->cursor_manager()->AddObserver(this); 27 ash::Shell::GetInstance()->cursor_manager()->AddObserver(this);
28 ash::Shell::GetInstance()->native_cursor_manager()->AddObserver(this);
26 ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); 29 ash::Shell::GetInstance()->window_tree_host_manager()->AddObserver(this);
27 aura::client::FocusClient* focus_client = 30 aura::client::FocusClient* focus_client =
28 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); 31 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
29 focus_client->AddObserver(this); 32 focus_client->AddObserver(this);
30 ui::DeviceDataManager::GetInstance()->AddObserver(this); 33 ui::DeviceDataManager::GetInstance()->AddObserver(this);
31 ash::Shell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); 34 ash::Shell::Get()->system_tray_notifier()->AddAccessibilityObserver(this);
32 } 35 }
33 36
34 WMHelperAsh::~WMHelperAsh() { 37 WMHelperAsh::~WMHelperAsh() {
35 if (!ash::Shell::HasInstance()) 38 if (!ash::Shell::HasInstance())
36 return; 39 return;
37 aura::client::FocusClient* focus_client = 40 aura::client::FocusClient* focus_client =
38 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); 41 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
39 focus_client->RemoveObserver(this); 42 focus_client->RemoveObserver(this);
40 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); 43 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
44 ash::Shell::GetInstance()->native_cursor_manager()->RemoveObserver(this);
41 ash::Shell::GetInstance()->cursor_manager()->RemoveObserver(this); 45 ash::Shell::GetInstance()->cursor_manager()->RemoveObserver(this);
42 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); 46 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this);
43 ash::Shell::GetInstance()->RemoveShellObserver(this); 47 ash::Shell::GetInstance()->RemoveShellObserver(this);
44 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); 48 ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
45 ash::Shell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); 49 ash::Shell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this);
46 } 50 }
47 51
48 //////////////////////////////////////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////////
49 // WMHelperAsh, private: 53 // WMHelperAsh, private:
50 54
51 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( 55 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo(
52 int64_t display_id) const { 56 int64_t display_id) const {
53 return ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( 57 return ash::Shell::GetInstance()->display_manager()->GetDisplayInfo(
54 display_id); 58 display_id);
55 } 59 }
56 60
57 aura::Window* WMHelperAsh::GetContainer(int container_id) { 61 aura::Window* WMHelperAsh::GetContainer(int64_t display_id, int container_id) {
58 return ash::Shell::GetContainer(ash::Shell::GetRootWindowForNewWindows(), 62 ash::RootWindowController* controller =
59 container_id); 63 ash::Shell::GetRootWindowControllerWithDisplayId(display_id);
64 return ash::Shell::GetContainer(
65 controller ? controller->GetRootWindow()
66 : ash::Shell::GetRootWindowForNewWindows(),
67 container_id);
60 } 68 }
61 69
62 aura::Window* WMHelperAsh::GetActiveWindow() const { 70 aura::Window* WMHelperAsh::GetActiveWindow() const {
63 return ash::Shell::GetInstance()->activation_client()->GetActiveWindow(); 71 return ash::Shell::GetInstance()->activation_client()->GetActiveWindow();
64 } 72 }
65 73
66 aura::Window* WMHelperAsh::GetFocusedWindow() const { 74 aura::Window* WMHelperAsh::GetFocusedWindow() const {
67 aura::client::FocusClient* focus_client = 75 aura::client::FocusClient* focus_client =
68 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); 76 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
69 return focus_client->GetFocusedWindow(); 77 return focus_client->GetFocusedWindow();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return ash::Shell::GetInstance() 111 return ash::Shell::GetInstance()
104 ->accessibility_delegate() 112 ->accessibility_delegate()
105 ->IsSpokenFeedbackEnabled(); 113 ->IsSpokenFeedbackEnabled();
106 } 114 }
107 115
108 void WMHelperAsh::PlayEarcon(int sound_key) const { 116 void WMHelperAsh::PlayEarcon(int sound_key) const {
109 return ash::Shell::GetInstance()->accessibility_delegate()->PlayEarcon( 117 return ash::Shell::GetInstance()->accessibility_delegate()->PlayEarcon(
110 sound_key); 118 sound_key);
111 } 119 }
112 120
121 void WMHelperAsh::SetCursor(gfx::NativeCursor cursor) {
122 ash::Shell* shell = ash::Shell::GetInstance();
123 static_cast<wm::NativeCursorManager*>(shell->native_cursor_manager())
124 ->SetCursor(cursor, shell->cursor_manager());
125 }
126
113 void WMHelperAsh::OnWindowActivated( 127 void WMHelperAsh::OnWindowActivated(
114 aura::client::ActivationChangeObserver::ActivationReason reason, 128 aura::client::ActivationChangeObserver::ActivationReason reason,
115 aura::Window* gained_active, 129 aura::Window* gained_active,
116 aura::Window* lost_active) { 130 aura::Window* lost_active) {
117 NotifyWindowActivated(gained_active, lost_active); 131 NotifyWindowActivated(gained_active, lost_active);
118 } 132 }
119 133
120 void WMHelperAsh::OnWindowFocused(aura::Window* gained_focus, 134 void WMHelperAsh::OnWindowFocused(aura::Window* gained_focus,
121 aura::Window* lost_focus) { 135 aura::Window* lost_focus) {
122 NotifyWindowFocused(gained_focus, lost_focus); 136 NotifyWindowFocused(gained_focus, lost_focus);
123 } 137 }
124 138
125 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) { 139 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) {
126 NotifyCursorVisibilityChanged(is_visible); 140 NotifyCursorVisibilityChanged(is_visible);
127 } 141 }
128 142
129 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) { 143 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) {
130 NotifyCursorSetChanged(cursor_set); 144 NotifyCursorSetChanged(cursor_set);
131 } 145 }
132 146
147 void WMHelperAsh::OnCursorDisplayChanging(const display::Display& display) {
148 NotifyCursorDisplayChanging(display);
149 }
150
133 void WMHelperAsh::OnAccessibilityModeChanged( 151 void WMHelperAsh::OnAccessibilityModeChanged(
134 ash::AccessibilityNotificationVisibility notify) { 152 ash::AccessibilityNotificationVisibility notify) {
135 NotifyAccessibilityModeChanged(); 153 NotifyAccessibilityModeChanged();
136 } 154 }
137 155
138 void WMHelperAsh::OnMaximizeModeStarted() { 156 void WMHelperAsh::OnMaximizeModeStarted() {
139 NotifyMaximizeModeStarted(); 157 NotifyMaximizeModeStarted();
140 } 158 }
141 159
142 void WMHelperAsh::OnMaximizeModeEnding() { 160 void WMHelperAsh::OnMaximizeModeEnding() {
143 NotifyMaximizeModeEnding(); 161 NotifyMaximizeModeEnding();
144 } 162 }
145 163
146 void WMHelperAsh::OnMaximizeModeEnded() { 164 void WMHelperAsh::OnMaximizeModeEnded() {
147 NotifyMaximizeModeEnded(); 165 NotifyMaximizeModeEnded();
148 } 166 }
149 167
150 void WMHelperAsh::OnDisplayConfigurationChanged() { 168 void WMHelperAsh::OnDisplayConfigurationChanged() {
151 NotifyDisplayConfigurationChanged(); 169 NotifyDisplayConfigurationChanged();
152 } 170 }
153 171
154 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() { 172 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() {
155 NotifyKeyboardDeviceConfigurationChanged(); 173 NotifyKeyboardDeviceConfigurationChanged();
156 } 174 }
157 175
158 } // namespace exo 176 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698