You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support DPI change in candidate/infolist window (google#1481)
This is part of our ongoing effort to fully conform Per-Monitor DPI v2
protocol in Windows (google#831).
With this commit, both the candidate window and the infolist window
become fully aware of dynamic DPI changes. The indicator window and
icons managed by text input processor (TIP) DLLs remain unchanged.
The key implementation idea is to not rely on WM_DPICHANGED message [1].
It is really tempting to implement WM_DPICHANGED handler, but it turns
out to be redundant for our use cases. Consider the following two cases
explained in the WM_DPICHANGED message document [1].
1. When the candidate/infolist window is moving into the monitor with a
different DPI. In this case, win32::WindowManager should be aware of
which monitor the candidate/infolist window will be displayed on,
and can let the candidate/infolist window know the new DPI without
relying on the WM_DPICHANGED message.
2. When the DPI of the current monitor changes while the
candidate/infolist window is visible. In this case, the target
application window typically re-renders to adapt to the new DPI,
which then triggers a fresh layout pass on our candidate/infolist
window. As explained above, win32::WindowManager always checks the
DPI of the target monitor without relying on the WM_DPICHANGED
message.
Both cases arise because the candidate and infolist windows behave like
popups anchored to the cursor location in the target application
window; WM_DPICHANGED is primarily meaningful for top-level windows
that users can drag and move across the monitors.
Other than that, the implementation is rather straightforward: we just
need to make sure to keep propagating the DPI information to the text
renderer and to update the DPI-dependent resources when the DPI changes.
Closesgoogle#1459.
[1]: https://learn.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged
PiperOrigin-RevId: 906746593
0 commit comments