Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: ui/gfx/win/window_impl.cc

Issue 2093323002: Allow Chrome's Non-Client Area To Be Scaled on DPI Changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wmdpi
Patch Set: Adjust Upstream Patchset Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4a9cbf6001f8287f1117ef2f63402d6ec2d8a156 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,19 @@ 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.
+ using EnableChildWindowDpiMessagePtr = LRESULT (WINAPI*)(HWND, BOOL);
+ return reinterpret_cast<EnableChildWindowDpiMessagePtr>(
+ GetProcAddress(GetModuleHandle(L"user32.dll"),
+ "EnableChildWindowDpiMessage"));
+ }();
+ 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698