| Index: ui/gfx/screen_win.cc
|
| diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
|
| index 23dbc9d60fbb865a6124b32d57690bbb41d21ba2..3d0706ddf71c113f1fcc69efc98d679db9dd2314 100644
|
| --- a/ui/gfx/screen_win.cc
|
| +++ b/ui/gfx/screen_win.cc
|
| @@ -6,24 +6,28 @@
|
|
|
| #include <windows.h>
|
|
|
| +#include "base/hash.h"
|
| #include "base/logging.h"
|
| +#include "base/strings/utf_string_conversions.h"
|
| #include "base/win/win_util.h"
|
| #include "ui/base/win/dpi.h"
|
| #include "ui/gfx/display.h"
|
|
|
| namespace {
|
|
|
| -MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) {
|
| - MONITORINFO monitor_info = { 0 };
|
| +MONITORINFOEX GetMonitorInfoForMonitor(HMONITOR monitor) {
|
| + MONITORINFOEX monitor_info;
|
| + ZeroMemory(&monitor_info, sizeof(MONITORINFOEX));
|
| monitor_info.cbSize = sizeof(monitor_info);
|
| base::win::GetMonitorInfoWrapper(monitor, &monitor_info);
|
| return monitor_info;
|
| }
|
|
|
| -gfx::Display GetDisplay(MONITORINFO& monitor_info) {
|
| - // TODO(oshima): Implement ID and Observer.
|
| +gfx::Display GetDisplay(MONITORINFOEX& monitor_info) {
|
| + // TODO(oshima): Implement Observer.
|
| + int64 id = static_cast<int64>(base::Hash(WideToUTF8(monitor_info.szDevice)));
|
| gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor);
|
| - gfx::Display display(0, bounds);
|
| + gfx::Display display(id, bounds);
|
| display.set_work_area(gfx::Rect(monitor_info.rcWork));
|
| display.SetScaleAndBounds(ui::win::GetDeviceScaleFactor(), bounds);
|
| return display;
|
| @@ -73,7 +77,7 @@ gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const {
|
| return GetPrimaryDisplay();
|
| }
|
|
|
| - MONITORINFO monitor_info;
|
| + MONITORINFOEX monitor_info;
|
| monitor_info.cbSize = sizeof(monitor_info);
|
| base::win::GetMonitorInfoWrapper(
|
| MonitorFromWindow(window_hwnd, MONITOR_DEFAULTTONEAREST), &monitor_info);
|
| @@ -83,7 +87,8 @@ gfx::Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const {
|
| gfx::Display ScreenWin::GetDisplayNearestPoint(const gfx::Point& point) const {
|
| POINT initial_loc = { point.x(), point.y() };
|
| HMONITOR monitor = MonitorFromPoint(initial_loc, MONITOR_DEFAULTTONEAREST);
|
| - MONITORINFO mi = {0};
|
| + MONITORINFOEX mi;
|
| + ZeroMemory(&mi, sizeof(MONITORINFOEX));
|
| mi.cbSize = sizeof(mi);
|
| if (monitor && base::win::GetMonitorInfoWrapper(monitor, &mi)) {
|
| return GetDisplay(mi);
|
| @@ -93,13 +98,13 @@ gfx::Display ScreenWin::GetDisplayNearestPoint(const gfx::Point& point) const {
|
|
|
| gfx::Display ScreenWin::GetDisplayMatching(const gfx::Rect& match_rect) const {
|
| RECT other_bounds_rect = match_rect.ToRECT();
|
| - MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
|
| + MONITORINFOEX monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
|
| &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
|
| return GetDisplay(monitor_info);
|
| }
|
|
|
| gfx::Display ScreenWin::GetPrimaryDisplay() const {
|
| - MONITORINFO mi = GetMonitorInfoForMonitor(
|
| + MONITORINFOEX mi = GetMonitorInfoForMonitor(
|
| MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY));
|
| gfx::Display display = GetDisplay(mi);
|
| // TODO(kevers|girard): Test if these checks can be reintroduced for high-DIP
|
|
|