Chromium Code Reviews| Index: ui/gfx/win/window_impl.cc |
| diff --git a/ui/gfx/win/window_impl.cc b/ui/gfx/win/window_impl.cc |
| index bf43ba59045490bbb0c169dcfe12637745d6fb36..a7077c478c5444962a971b6b9f0390da112538ef 100644 |
| --- a/ui/gfx/win/window_impl.cc |
| +++ b/ui/gfx/win/window_impl.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/memory/singleton.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/synchronization/lock.h" |
| +#include "base/win/win_util.h" |
| #include "base/win/wrapped_window_proc.h" |
| #include "ui/gfx/win/hwnd_util.h" |
| @@ -212,6 +213,22 @@ void WindowImpl::Init(HWND parent, const Rect& bounds) { |
| reinterpret_cast<wchar_t*>(atom), NULL, |
| window_style_, x, y, width, height, |
| parent, NULL, NULL, this); |
| + if (hwnd && base::win::IsProcessPerMonitorDpiAware()) { |
| + static auto enable_child_window_dpi_message_func = []() { |
| + // Derived signature; not available in headers. |
| + // This call gets Windows to scale the non-client area when WM_DPICHANGED |
| + // is fired. |
|
scottmg
2016/06/27 19:26:35
Any semi-documentation you can link here?
robliao
2016/06/27 19:58:07
Unfortunately not that I can find. This is pretty
|
| + using EnableChildWindowDpiMessagePtr = LRESULT (WINAPI*)(HWND, BOOL); |
| + HMODULE user32 = GetModuleHandle(L"user32"); |
|
scottmg
2016/06/27 19:26:35
Other instances seem to include ".dll".
robliao
2016/06/27 19:58:07
Done.
|
| + if (user32) { |
|
scottmg
2016/06/27 19:26:35
Don't think you need to check user32 here, just in
robliao
2016/06/27 19:58:07
Done. Yup, we seem to do it in other places indeed
|
| + return reinterpret_cast<EnableChildWindowDpiMessagePtr>( |
| + GetProcAddress(user32, "EnableChildWindowDpiMessage")); |
| + } |
| + return reinterpret_cast<EnableChildWindowDpiMessagePtr>(nullptr); |
| + }(); |
| + if (enable_child_window_dpi_message_func) |
| + enable_child_window_dpi_message_func(hwnd, TRUE); |
| + } |
| // First nccalcszie (during CreateWindow) for captioned windows is |
| // deliberately ignored so force a second one here to get the right |