summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-04-08 12:58:51 +0200
committerJan Holesovsky <kendy@collabora.com>2014-04-08 13:06:08 +0200
commitd06269447f8de52fd35e4e97d127279cc3f84025 (patch)
treeaa9c44cd0c5a6517c4faa0fc3c713f8e49f6dee6
parentf6406c910a60c075ca3c4928c7f451eae3ab751f (diff)
fdo#77059, hidpi: Increase the threshold of what DPI we consider hi-dpi.
Change-Id: I79802df4c11b3543140672419d78b697848b7c36
-rw-r--r--vcl/source/window/window.cxx30
1 files changed, 20 insertions, 10 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 0596e0c62d94..ef6e2bb12265 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -854,6 +854,23 @@ static bool ImplDoTiledRendering()
#endif
}
+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" );
@@ -1108,11 +1125,8 @@ 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 = mxSettings->GetStyleSettings();
sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
@@ -1810,11 +1824,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 )