Use gdi dpi scaling for Windows dialog

- tweak dpi scaling for ColourPopup dialog.

ref #14959

Close #15186
pull/15189/head
ozone10 2024-05-24 19:03:28 +02:00 committed by Don Ho
parent 00ea1a9089
commit 6c5f0009b4
2 changed files with 11 additions and 5 deletions

View File

@ -49,8 +49,7 @@ void ColourPopup::doDialog(POINT p)
{
if (!isCreated())
{
const DPI_AWARENESS_CONTEXT dpiContextSystem = NppDarkMode::isWindows10() ? DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED : DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
const auto dpiContext = DPIManagerV2::setThreadDpiAwarenessContext(dpiContextSystem);
const auto dpiContext = DPIManagerV2::setThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED);
create(IDD_COLOUR_POPUP);
@ -248,8 +247,7 @@ intptr_t CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
display(false);
const DPI_AWARENESS_CONTEXT dpiContextSystem = NppDarkMode::isWindows10() ? DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED : DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
const auto dpiContext = DPIManagerV2::setThreadDpiAwarenessContext(dpiContextSystem);
const auto dpiContext = DPIManagerV2::setThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED);
const bool isCreated = ChooseColor(&cc) == TRUE;
if (dpiContext != NULL)
{

View File

@ -552,7 +552,15 @@ void WindowsDlg::updateButtonState()
int WindowsDlg::doDialog()
{
return static_cast<int>(DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_WINDOWS), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
const auto dpiContext = DPIManagerV2::setThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED);
int result = static_cast<int>(DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_WINDOWS), _hParent, dlgProc, reinterpret_cast<LPARAM>(this)));
if (dpiContext != NULL)
{
DPIManagerV2::setThreadDpiAwarenessContext(dpiContext);
}
return result;
}
BOOL WindowsDlg::onInitDialog()