summaryrefslogtreecommitdiff
path: root/vcl/source/window/window.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/window.cxx')
-rw-r--r--vcl/source/window/window.cxx30
1 files changed, 19 insertions, 11 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index f477b5c02c7f..3fb1f006a44b 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 )