Chromium Code Reviews| Index: components/exo/pointer.cc |
| diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc |
| index b10d0186d798e64a6b47f7ca69e1dd9fe5b95bac..e3b807e959ddee44178726305850818678b858a0 100644 |
| --- a/components/exo/pointer.cc |
| +++ b/components/exo/pointer.cc |
| @@ -307,14 +307,26 @@ void Pointer::UpdateCursorScale() { |
| if (!focus_) |
| return; |
| + auto screen = display::Screen::GetScreen(); |
| + auto 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) |
| + auto display = screen->GetDisplayNearestWindow(widget_->GetNativeWindow()); |
|
reveman
2017/01/23 22:22:34
nit: Avoid "auto" here to make it clear what the t
Dominik Laskowski
2017/01/23 23:50:53
Done, and above too.
|
| + float ui_scale = helper->GetDisplayInfo(display.id()).GetEffectiveUIScale(); |
| + |
|
reveman
2017/01/23 22:22:34
nit: is this blank line intentional? remove if not
Dominik Laskowski
2017/01/23 23:50:53
Removed in second patch.
|
| + float primary_dsf = screen->GetPrimaryDisplay().device_scale_factor(); |
|
reveman
2017/01/23 22:22:34
nit: remove abbreviation. s/primary_dsf/primary_de
Dominik Laskowski
2017/01/23 23:50:53
Done.
|
| + |
| + // The cursor is scaled down by the DSF of the primary display, and its |
|
reveman
2017/01/23 22:22:34
scaled up?
Dominik Laskowski
2017/01/23 23:50:53
I meant that the surface size is divided by the pr
|
| + // 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_dsf) { |
| + auto info = helper->GetDisplayInfo(display::Display::InternalDisplayId()); |
|
reveman
2017/01/23 22:22:34
nit: maybe internal_display_device_scale_factor in
Dominik Laskowski
2017/01/23 23:50:53
Removed variable.
|
| + ui_scale *= primary_dsf / info.device_scale_factor(); |
| + } |
| + |
| + if (helper->GetCursorSet() == ui::CURSOR_SET_LARGE) |
| ui_scale *= kLargeCursorScale; |
| if (ui_scale != cursor_scale_) { |