Handle all pixel values in XRC as being DPI-independent.

Pixel values in XRC can never be correct for high resolution displays, unlike
the pixel values passed to wxWidgets API, which could be already adjusted to
account for the resolution or obtained from resolution-dependent text metrics,
so scale them by the factor appropriate for the current resolution
automatically.
This commit is contained in:
Vadim Zeitlin
2015-04-20 20:07:57 +02:00
parent 100d2a5819
commit 277b848364
3 changed files with 16 additions and 9 deletions

View File

@@ -2125,11 +2125,11 @@ ParseValueInPixels(wxXmlResourceHandlerImpl* impl,
return defaultValue;
}
if ( !windowToUse )
windowToUse = impl->GetParentAsWindow();
if ( inDLU )
{
if ( !windowToUse )
windowToUse = impl->GetParentAsWindow();
if ( !windowToUse )
{
impl->ReportParamError
@@ -2143,6 +2143,10 @@ ParseValueInPixels(wxXmlResourceHandlerImpl* impl,
XRCConvertFromDLU(windowToUse, value);
}
else // The value is in resolution-independent pixels.
{
value = wxWindow::FromDIP(value, windowToUse);
}
return value;
}