[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - vcl/source

Jan Holesovsky kendy at collabora.com
Tue Apr 8 07:37:19 PDT 2014


 vcl/source/window/window.cxx |   30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

New commits:
commit bcba071c0d583a0b3a62d6d718829b906ecc37f2
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Apr 8 12:58:51 2014 +0200

    fdo#77059, hidpi: Increase the threshold of what DPI we consider hi-dpi.
    
    Conflicts:
    	vcl/source/window/window.cxx
    
    Change-Id: I79802df4c11b3543140672419d78b697848b7c36
    Reviewed-on: https://gerrit.libreoffice.org/8892
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index f477b5c..3fb1f00 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -732,6 +732,23 @@ void Window::ImplInitWindowData( WindowType nType )
 
 // -----------------------------------------------------------------------
 
+static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI)
+{
+    sal_Int32 nResult = 1;
+
+#ifndef MACOSX
+    // Setting of HiDPI is unfortunately all only a heuristic; and to add
+    // insult to an injury, the system is constantly lying to us about
+    // the DPI and whatnot
+    // eg. fdo#77059 - set the value from which we do consider the
+    // screen hi-dpi to greater than 168
+    if (nDPI > 168)
+        nResult = std::max(sal_Int32(1), (nDPI) / 96);
+#endif
+
+    return nResult;
+}
+
 void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
 {
     DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" );
@@ -983,11 +1000,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
     }
 
     // setup the scale factor for Hi-DPI displays
-#ifdef MACOSX
-    mnDPIScaleFactor = 1;
-#else
-    mnDPIScaleFactor = std::max((sal_Int32)1, (mpWindowImpl->mpFrameData->mnDPIY + 48) / 96);
-#endif
+    mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
 
     const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
     sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
@@ -1727,12 +1740,7 @@ void Window::ImplInitResolutionSettings()
         mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
 
         // setup the scale factor for Hi-DPI displays
-#ifdef MACOSX
-        mnDPIScaleFactor = 1;
-#else
-        mnDPIScaleFactor = std::max((sal_Int32)1, (mpWindowImpl->mpFrameData->mnDPIY + 48) / 96);
-#endif
-
+        mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
         SetPointFont( rStyleSettings.GetAppFont() );
     }
     else if ( mpWindowImpl->mpParent )


More information about the Libreoffice-commits mailing list