Chromium Code Reviews| 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() || |
|
oshima
2017/01/24 20:48:19
Isn't this && ?
Dominik Laskowski
2017/01/24 22:14:34
No, we want to avoid scaling if:
1) The window is
oshima
2017/01/25 21:16:01
The size of the cursor should be same (50x50 pixel
|
| + display.device_scale_factor() != primary_device_scale_factor) { |
|
oshima
2017/01/24 20:48:19
My understanding was that if the android scale fac
Dominik Laskowski
2017/01/24 22:14:34
It's a bit more complicated because:
1) HWC divid
|
| + 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_) { |