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

Unified Diff: components/exo/pointer.cc

Issue 2657673005: [M57] exo: Fix cursor size for multi-display ARC (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/pointer.cc
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc
index b10d0186d798e64a6b47f7ca69e1dd9fe5b95bac..bd267e04bc6483bdfa5c4ad0d23add376fc1ff30 100644
--- a/components/exo/pointer.cc
+++ b/components/exo/pointer.cc
@@ -307,14 +307,32 @@ void Pointer::UpdateCursorScale() {
if (!focus_)
return;
+ display::Screen* screen = display::Screen::GetScreen();
+ WMHelper* helper = WMHelper::GetInstance();
+
// Update cursor scale if the effective UI scale has changed.
display::Display display =
- display::Screen::GetScreen()->GetDisplayNearestWindow(
- widget_->GetNativeWindow());
- float ui_scale = WMHelper::GetInstance()
- ->GetDisplayInfo(display.id())
- .GetEffectiveUIScale();
- if (WMHelper::GetInstance()->GetCursorSet() == ui::CURSOR_SET_LARGE)
+ screen->GetDisplayNearestWindow(widget_->GetNativeWindow());
+ float ui_scale = helper->GetDisplayInfo(display.id()).GetEffectiveUIScale();
+
+ if (display::Display::HasInternalDisplay()) {
+ float primary_device_scale_factor =
+ screen->GetPrimaryDisplay().device_scale_factor();
+
+ // The size of the cursor surface is the quotient of its physical size and
+ // the DSF of the primary display. The physical size is proportional to the
+ // DSF of the internal display. For external displays (and the internal
+ // display when secondary to a display with a different DSF), scale the
+ // cursor so its physical size matches with the single display case.
+ if (!display.IsInternal() ||
+ display.device_scale_factor() != primary_device_scale_factor) {
+ ui_scale *= primary_device_scale_factor /
+ helper->GetDisplayInfo(display::Display::InternalDisplayId())
+ .device_scale_factor();
+ }
+ }
+
+ if (helper->GetCursorSet() == ui::CURSOR_SET_LARGE)
ui_scale *= kLargeCursorScale;
if (ui_scale != cursor_scale_) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698