Index: ash/mus/bridge/shell_port_mash.cc |
diff --git a/ash/mus/bridge/shell_port_mash.cc b/ash/mus/bridge/shell_port_mash.cc |
index 58fa0608d8f44d272a2c8c6b6b013bde0800a98e..1495cf097ec0a90d632180520f29fc5bfc7ce2bf 100644 |
--- a/ash/mus/bridge/shell_port_mash.cc |
+++ b/ash/mus/bridge/shell_port_mash.cc |
@@ -131,27 +131,47 @@ ShellPortMash::CreateTouchTransformDelegate() { |
} |
void ShellPortMash::LockCursor() { |
- window_manager_->window_manager_client()->LockCursor(); |
+ // When we are running in mus, we need to keep track of state not just in the |
+ // window server, but also locally in ash because ash treats the cursor |
+ // manager as the canonical state for now. NativeCursorManagerAsh will keep |
+ // this state, while also forwarding it to the window manager for us. |
+ if (mus_state_) |
James Cook
2017/06/29 19:43:24
nit: I think these if()s would be clearer if they
Elliot Glaysher
2017/06/29 21:39:36
Done.
|
+ Shell::Get()->cursor_manager()->LockCursor(); |
+ else |
+ window_manager_->window_manager_client()->LockCursor(); |
} |
void ShellPortMash::UnlockCursor() { |
- window_manager_->window_manager_client()->UnlockCursor(); |
+ if (mus_state_) |
+ Shell::Get()->cursor_manager()->UnlockCursor(); |
+ else |
+ window_manager_->window_manager_client()->UnlockCursor(); |
} |
void ShellPortMash::ShowCursor() { |
- window_manager_->window_manager_client()->SetCursorVisible(true); |
+ if (mus_state_) |
+ Shell::Get()->cursor_manager()->ShowCursor(); |
+ else |
+ window_manager_->window_manager_client()->SetCursorVisible(true); |
} |
void ShellPortMash::HideCursor() { |
- window_manager_->window_manager_client()->SetCursorVisible(false); |
+ if (mus_state_) |
+ Shell::Get()->cursor_manager()->HideCursor(); |
+ else |
+ window_manager_->window_manager_client()->SetCursorVisible(false); |
} |
void ShellPortMash::SetCursorSize(ui::CursorSize cursor_size) { |
- window_manager_->window_manager_client()->SetCursorSize(cursor_size); |
+ if (mus_state_) |
+ Shell::Get()->cursor_manager()->SetCursorSize(cursor_size); |
+ else |
+ window_manager_->window_manager_client()->SetCursorSize(cursor_size); |
} |
void ShellPortMash::SetGlobalOverrideCursor( |
base::Optional<ui::CursorData> cursor) { |
+ DCHECK(mash_state_); |
window_manager_->window_manager_client()->SetGlobalOverrideCursor( |
std::move(cursor)); |
} |