Conform Per-Monitor DPI v2 protocol in Windows
- Dominant language
- C++
- Stars
- 3k
- Forks
- 525
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Currently Mozc binaries fall into [System DPI Awareness](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows#system-dpi-awareness) category in Windows.
We'd like to make them run under [Per-Monitor v2 Awareness mode](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows#per-monitor-and-per-monitor-v2-dpi-awareness).
## Version or commit-id
af209061632ba7dcc64b63bd06eb988974375508
## Environment
- OS: Windows 11 22H2
## Additional Context
### `src/gui/tool/mozc_tool.exe.manifest`
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/gui/tool/mozc_tool.exe.manifest#L25-L27
Needs `PerMonitorV2` declaration.
```
PerMonitorV2
```
Also, it'd be safer to switch to Qt 6.6 or later version, which contains https://github.com/qt/qtbase/commit/5e0d9a077d28802988182319ae257e9102f0344e.
-----
### `src/renderer/win32/mozc_renderer.exe.manifest`
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/renderer/win32/mozc_renderer.exe.manifest#L25-L27
Needs `PerMonitorV2` declaration.
```
PerMonitorV2
```
-----
### `src/renderer/win32/indicator_window.cc`
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/renderer/win32/indicator_window.cc#L96-L100
We can no longer assume this is a runtime constant.
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/renderer/win32/indicator_window.cc#L115-L119
We also need to handle [WM_DPICHANGED](https://learn.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged).
-----
### `src/renderer/win32/candidate_window.h`
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/renderer/win32/candidate_window.h#L77-L88
We also need to handle [WM_DPICHANGED](https://learn.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged).
-----
### `src/renderer/win32/candidate_window.cc`
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/renderer/win32/candidate_window.cc#L234-L265
`scale_factor_x` and `scale_factor_y` are no longer the runtime constants. We need to re-calculate these values every time [WM_DPICHANGED](https://learn.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged) is received.
-----
### `src/win32/tip/tip_lang_bar_menu.cc`
`LoadIconFromResource` should use `GetSystemMetricsForDpi` with primary display's DPI no matter which display is used to show the application, because the IME mode icon is shown only on the primary display.
https://github.com/google/mozc/blob/af209061632ba7dcc64b63bd06eb988974375508/src/win32/tip/tip_lang_bar_menu.cc#L105-L119
Contributor guide
Assessment
This issue has not been assessed yet.