| 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 for (aura::Window* root : Shell::Get()->GetAllRootWindows()) |
| 50 root->GetHost()->SetCursor(cursor); |
| 51 |
| 47 Shell::Get() | 52 Shell::Get() |
| 48 ->window_tree_host_manager() | 53 ->window_tree_host_manager() |
| 49 ->cursor_window_controller() | 54 ->cursor_window_controller() |
| 50 ->SetCursor(cursor); | 55 ->SetCursor(cursor); |
| 51 } | 56 } |
| 52 | 57 |
| 53 void NotifyCursorVisibilityChange(bool visible) { | 58 void NotifyCursorVisibilityChange(bool visible) { |
| 54 // Communicate the cursor visibility state to the mus server. | 59 // Communicate the cursor visibility state to the mus server. |
| 55 if (visible) | 60 if (visible) |
| 56 ShellPort::Get()->ShowCursor(); | 61 ShellPort::Get()->ShowCursor(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } else { | 203 } else { |
| 199 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); | 204 disabled_cursor_location_ = aura::Env::GetInstance()->last_mouse_location(); |
| 200 } | 205 } |
| 201 | 206 |
| 202 SetVisibility(delegate->IsCursorVisible(), delegate); | 207 SetVisibility(delegate->IsCursorVisible(), delegate); |
| 203 | 208 |
| 204 NotifyMouseEventsEnableStateChange(enabled); | 209 NotifyMouseEventsEnableStateChange(enabled); |
| 205 } | 210 } |
| 206 | 211 |
| 207 } // namespace ash | 212 } // namespace ash |
| OLD | NEW |