From 49801e57f1ba83361b03622b72fac0956797a147 Mon Sep 17 00:00:00 2001 From: David Vanderson Date: Mon, 8 Aug 2016 14:00:07 +0200 Subject: [PATCH] Implement wxGetDisplaySizeMM() correctly in wxOSX Return the real screen size instead of hard-coding 72 DPI. Closes #17614. --- docs/changes.txt | 1 + src/osx/utils_osx.cpp | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index c9b7521f87..5a49e023ef 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -120,6 +120,7 @@ wxMSW: wxOSX: - Fix handling of non-BMP characters in GetPartialTextExtents() (ARATA Mizuki). +- Implement wxGetDisplaySizeMM() correctly (David Vanderson). - Remove extra borders around wxFilePickerCtrl (John Roberts). - Set up extensions filter correctly in wxFileDialog (nick863). - Turn off automatic quotes substitutions in wxTextCtrl (Xlord2). diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index d71457c676..a89b043f01 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -157,15 +157,11 @@ bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) void wxDisplaySizeMM(int *width, int *height) { - wxDisplaySize(width, height); - // on mac 72 is fixed (at least now;-) - double cvPt2Mm = 25.4 / 72; - - if (width != NULL) - *width = int( *width * cvPt2Mm ); - - if (height != NULL) - *height = int( *height * cvPt2Mm ); + CGSize size = CGDisplayScreenSize(CGMainDisplayID()); + if ( width ) + *width = (int)size.width ; + if ( height ) + *height = (int)size.height; }