Change DPI awareness only for ChooseFont() duration
Extract ChooseFont() in a small helper function to ensure that the DPI awareness is restored as soon as it returns. No real changes yet.
This commit is contained in:
parent
caac3a4f19
commit
f68993111c
1 changed files with 9 additions and 3 deletions
|
|
@ -88,6 +88,14 @@ wxString wxFontDialog::GetTitle() const
|
|||
return m_title;
|
||||
}
|
||||
|
||||
// Tiny wrapper calling ::ChooseFont() with system DPI awareness, as the
|
||||
// standard dialog doesn't work correctly when using per-monitor awareness.
|
||||
static BOOL wxMSWChooseFont(CHOOSEFONT* pCF)
|
||||
{
|
||||
wxMSWImpl::AutoSystemDpiAware dpiAwareness;
|
||||
return ::ChooseFont(pCF);
|
||||
}
|
||||
|
||||
int wxFontDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
|
@ -153,9 +161,7 @@ int wxFontDialog::ShowModal()
|
|||
|
||||
chooseFontStruct.Flags = flags;
|
||||
|
||||
wxMSWImpl::AutoSystemDpiAware dpiAwareness;
|
||||
|
||||
if ( ChooseFont(&chooseFontStruct) != 0 )
|
||||
if ( wxMSWChooseFont(&chooseFontStruct) != 0 )
|
||||
{
|
||||
wxRGBToColour(m_fontData.m_fontColour, chooseFontStruct.rgbColors);
|
||||
m_fontData.m_chosenFont = wxFont(wxNativeFontInfo(logFont, this));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue