Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ash/wm/native_cursor_manager_ash_mus.h" | 5 #include "ash/wm/native_cursor_manager_ash_mus.h" |
| 6 | 6 |
| 7 #include "ash/display/cursor_window_controller.h" | 7 #include "ash/display/cursor_window_controller.h" |
| 8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" | 10 #include "ash/shell_port.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #endif | 37 #endif |
| 38 } else { | 38 } else { |
| 39 mojo_cursor = ui::CursorData(cursor.native_type()); | 39 mojo_cursor = ui::CursorData(cursor.native_type()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // As the window manager, tell mus to use |mojo_cursor| everywhere. We do | 42 // As the window manager, tell mus to use |mojo_cursor| everywhere. We do |
| 43 // this instead of trying to set per-window because otherwise we run into the | 43 // this instead of trying to set per-window because otherwise we run into the |
| 44 // event targeting issue. | 44 // event targeting issue. |
| 45 ShellPort::Get()->SetGlobalOverrideCursor(mojo_cursor); | 45 ShellPort::Get()->SetGlobalOverrideCursor(mojo_cursor); |
| 46 | 46 |
| 47 // Make sure the local state is set properly, so that local queries show that | |
| 48 // we set the cursor. | |
| 49 aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows(); | |
| 50 for (aura::Window::Windows::iterator iter = root_windows.begin(); | |
|
sky
2017/06/23 23:31:28
for (aura::Window* root : Shell::Get()->GetAllRoot
| |
| 51 iter != root_windows.end(); ++iter) | |
| 52 (*iter)->GetHost()->SetCursor(cursor); | |
| 53 | |
| 47 Shell::Get() | 54 Shell::Get() |
| 48 ->window_tree_host_manager() | 55 ->window_tree_host_manager() |
| 49 ->cursor_window_controller() | 56 ->cursor_window_controller() |
| 50 ->SetCursor(cursor); | 57 ->SetCursor(cursor); |
| 51 } | 58 } |
| 52 | 59 |
| 53 void NotifyCursorVisibilityChange(bool visible) { | 60 void NotifyCursorVisibilityChange(bool visible) { |
| 54 // Communicate the cursor visibility state to the mus server. | 61 // Communicate the cursor visibility state to the mus server. |
| 55 if (visible) | 62 if (visible) |
| 56 ShellPort::Get()->ShowCursor(); | 63 ShellPort::Get()->ShowCursor(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 } else { | 205 } else { |
| 199 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); | 206 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); |
| 200 } | 207 } |
| 201 | 208 |
| 202 SetVisibility(delegate->IsCursorVisible(), delegate); | 209 SetVisibility(delegate->IsCursorVisible(), delegate); |
| 203 | 210 |
| 204 NotifyMouseEventsEnableStateChange(enabled); | 211 NotifyMouseEventsEnableStateChange(enabled); |
| 205 } | 212 } |
| 206 | 213 |
| 207 } // namespace ash | 214 } // namespace ash |
| OLD | NEW |