| Index: ui/gfx/screen_win.cc
|
| diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
|
| index 3199f7acaacdd2b15c3dca37d09014dc418c2d00..b4bc7a02293f5cfa5c61e36b089dd3c84f44ffb8 100644
|
| --- a/ui/gfx/screen_win.cc
|
| +++ b/ui/gfx/screen_win.cc
|
| @@ -5,7 +5,6 @@
|
| #include "ui/gfx/screen_win.h"
|
|
|
| #include <windows.h>
|
| -#include <stdint.h>
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| @@ -15,6 +14,7 @@
|
| #include "base/win/win_util.h"
|
| #include "ui/gfx/display.h"
|
| #include "ui/gfx/win/dpi.h"
|
| +#include "ui/gfx/win/physical_size.h"
|
|
|
| namespace {
|
|
|
| @@ -26,9 +26,12 @@ MONITORINFOEX GetMonitorInfoForMonitor(HMONITOR monitor) {
|
| return monitor_info;
|
| }
|
|
|
| +int64_t GenerateDisplayId(const std::string& str) {
|
| + return static_cast<int64_t>(base::Hash(str));
|
| +}
|
| +
|
| gfx::Display GetDisplay(const MONITORINFOEX& monitor_info) {
|
| - int64_t id =
|
| - static_cast<int64_t>(base::Hash(base::WideToUTF8(monitor_info.szDevice)));
|
| + int64_t id = GenerateDisplayId(base::WideToUTF8(monitor_info.szDevice));
|
| gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor);
|
| gfx::Display display(id);
|
| display.set_bounds(gfx::win::ScreenToDIPRect(bounds));
|
| @@ -36,6 +39,19 @@ gfx::Display GetDisplay(const MONITORINFOEX& monitor_info) {
|
| gfx::win::ScreenToDIPRect(gfx::Rect(monitor_info.rcWork)));
|
| display.SetScaleAndBounds(gfx::GetDPIScale(), bounds);
|
|
|
| + int width_mm = 0;
|
| + int height_mm = 0;
|
| + std::vector<gfx::PhysicalDisplaySize> display_sizes =
|
| + gfx::GetPhysicalSizeForDisplays();
|
| + for (const auto& display_size : display_sizes) {
|
| + int64_t interface_id = GenerateDisplayId(display_size.display_name);
|
| + if (interface_id == id) {
|
| + width_mm = display_size.width_mm;
|
| + height_mm = display_size.height_mm;
|
| + }
|
| + }
|
| + display.SetPhysicalSize(width_mm, height_mm);
|
| +
|
| DEVMODE mode;
|
| memset(&mode, 0, sizeof(DEVMODE));
|
| mode.dmSize = sizeof(DEVMODE);
|
|
|