Merge branch 'display-ppi-from-scaling-factor'

Determine display DPI from scaling factor instead of trying to compute
it from the physical display dimensions.

See https://github.com/wxWidgets/wxWidgets/pull/2015

Closes #18855.
This commit is contained in:
Vadim Zeitlin
2020-08-24 00:14:27 +02:00
20 changed files with 232 additions and 215 deletions

View File

@@ -143,6 +143,46 @@ public:
*/
wxSize GetPPI() const;
/**
Returns scaling factor used by this display.
The scaling factor is the ratio between GetPPI() and GetStdPPI()
(it is implicitly assumed that this ratio is the same for both
horizontal and vertical components).
@see wxWindow::GetContentScaleFactor(), wxWindow::GetDPIScaleFactor()
@since 3.1.5
*/
double GetScaleFactor() const;
/**
Returns default display resolution for the current platform in pixels
per inch.
This function mostly used internally, use GetPPI() to get the actual
display resolution.
Currently the standard PPI is the same in both horizontal and vertical
directions on all platforms and its value is 96 everywhere except under
Apple devices (those running macOS, iOS, watchOS etc), where it is 72.
@see GetStdPPI()
@since 3.1.5
*/
static int GetStdPPIValue();
/**
Returns default display resolution for the current platform as wxSize.
This function is equivalent to constructing wxSize object with both
components set to GetStdPPIValue().
@since 3.1.5
*/
static wxSize GetStdPPI();
/**
Returns @true if the display is the primary display. The primary
display is the one whose index is 0.