Commit 79121dad authored by Elliot Glaysher's avatar Elliot Glaysher Committed by Commit Bot

[ash] Use cursor compositing when we are in unified mode.

This resolves the problem where the hardware cursor is shown in one
window when unified mode is turned on. We might not have an active pref
service yet, so move the checks that don't depend on preferences before
checking the pref service.

Bug: 805719
Change-Id: I92c1ea1a47a0cd63f695fc792e1fe025ee715962
Reviewed-on: https://chromium-review.googlesource.com/887288
Commit-Queue: Elliot Glaysher <erg@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532025}
parent eed1dfad
...@@ -114,19 +114,26 @@ void CursorWindowController::SetLargeCursorSizeInDip( ...@@ -114,19 +114,26 @@ void CursorWindowController::SetLargeCursorSizeInDip(
} }
bool CursorWindowController::ShouldEnableCursorCompositing() { bool CursorWindowController::ShouldEnableCursorCompositing() {
// During startup, we may not have a preference service yet. We need to check
// display manager state first so that we don't accidentally ignore it while
// early outing when there isn't a PrefService yet.
display::DisplayManager* display_manager = Shell::Get()->display_manager();
if ((display_manager->is_multi_mirroring_enabled() &&
display_manager->IsInSoftwareMirrorMode()) ||
display_manager->IsInUnifiedMode()) {
return true;
}
PrefService* prefs = PrefService* prefs =
Shell::Get()->session_controller()->GetActivePrefService(); Shell::Get()->session_controller()->GetActivePrefService();
if (!prefs) { if (!prefs) {
// The active pref service can be null early in startup. // The active pref service can be null early in startup.
return false; return false;
} }
display::DisplayManager* display_manager = Shell::Get()->display_manager();
return prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled) || return prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled) ||
prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled) || prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled) ||
prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled) || prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled) ||
prefs->GetBoolean(prefs::kNightLightEnabled) || prefs->GetBoolean(prefs::kNightLightEnabled);
(display_manager->is_multi_mirroring_enabled() &&
display_manager->IsInSoftwareMirrorMode());
} }
void CursorWindowController::SetCursorCompositingEnabled(bool enabled) { void CursorWindowController::SetCursorCompositingEnabled(bool enabled) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment