From e902050002dae11871eff89151dec7a8a895f3a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 6 Aug 2020 23:58:05 +0200 Subject: [PATCH] Return "logical" PPI from wxDisplay::GetPPI() in wxGTK3 Just scale the standard PPI by the scaling factor instead of trying to compute the actual physical PPI, as the latter is not useful and is incompatible with the value used by all the other applications. --- src/gtk/display.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index b1bdacb196..b21a0c2295 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -350,7 +350,17 @@ double wxDisplayImplGTK::GetScaleFactor() const return 1.0; } -#endif // GTK+ 3.10 + +wxSize wxDisplayImplGTK::GetPPI() const +{ + // The useful value of PPI is the scaled value of the default PPI and not + // the actual PPI computed by dividing the number of pixels by the physical + // screen size: this is what everyone else uses, and so we should do it + // too. + return wxDisplay::GetStdPPI()*GetScaleFactor(); +} + +#else // GTK+ < 3.10 wxSize wxDisplayImplGTK::GetPPI() const { @@ -370,6 +380,8 @@ wxSize wxDisplayImplGTK::GetPPI() const return ppi; } +#endif // GTK+ 3.10 + wxSize wxDisplayImplGTK::GetSizeMM() const { wxSize sizeMM;