From 4af9688d68fc5f15ce94d8b37b1bac8403099b26 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Sun, 22 Oct 2023 18:00:25 +0000 Subject: [PATCH] Fix window locations under Per-Monitor DPI in Windows This is a minimum change to place candidate windows around the cursor location even under Per-Monitor DPI mode in Windows. Note that there are still known issues that 'mozc_render' continues using the initial DPI. Watch #831 for such remaining issues. Closes #832. PiperOrigin-RevId: 575633393 --- src/renderer/win32/candidate_window.cc | 4 ++++ src/renderer/win32/candidate_window.h | 2 ++ src/renderer/win32/infolist_window.cc | 4 ++++ src/renderer/win32/infolist_window.h | 2 ++ src/renderer/win32/mozc_renderer.exe.manifest | 3 +++ 5 files changed, 15 insertions(+) diff --git a/src/renderer/win32/candidate_window.cc b/src/renderer/win32/candidate_window.cc index 2f0f284ce8..7377a332cf 100644 --- a/src/renderer/win32/candidate_window.cc +++ b/src/renderer/win32/candidate_window.cc @@ -291,6 +291,10 @@ void CandidateWindow::OnDestroy() { ::PostQuitMessage(0); } +void CandidateWindow::OnDpiChanged(UINT dpiX, UINT dpiY, RECT *rect) { + metrics_changed_ = true; +} + BOOL CandidateWindow::OnEraseBkgnd(CDCHandle dc) { // We do not have to erase background // because all pixels in client area will be drawn in the DoPaint method. diff --git a/src/renderer/win32/candidate_window.h b/src/renderer/win32/candidate_window.h index 03696e4a93..2e4d58d4a6 100644 --- a/src/renderer/win32/candidate_window.h +++ b/src/renderer/win32/candidate_window.h @@ -77,6 +77,7 @@ class CandidateWindow : public ATL::CWindowImpl true + + PerMonitorV2 +