summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbscreen.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-22 12:25:33 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-07-30 12:45:07 +0000
commitec462b245fa138a6b036f3db9c960015a36fd828 (patch)
treebfe4656894acc00f5ce2ef4af7641bcacace2670 /src/plugins/platforms/xcb/qxcbscreen.cpp
parentfd6821740fece8650cac7494a2cffe63e2bebb9c (diff)
X11 changes for highdpi
Adapt the xcb plugin to work with the new cross-platform high-DPI scaling. Fixes for drag and drop is done in a separate change. Task-number: QTBUG-46615 Change-Id: I29002721169750b9de59edb0f3e9134adabc4855 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 8a4753591a..29262b5847 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -44,6 +44,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <private/qmath_p.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE
@@ -86,6 +87,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
, m_orientation(Qt::PrimaryOrientation)
, m_refreshRate(60)
, m_forcedDpi(-1)
+ , m_pixelDensity(1)
, m_hintStyle(QFontEngine::HintStyle(-1))
, m_noFontHinting(false)
, m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1))
@@ -302,6 +304,11 @@ QDpi QXcbScreen::logicalDpi() const
return virtualDpi();
}
+qreal QXcbScreen::pixelDensity() const
+{
+ return m_pixelDensity;
+}
+
QPlatformCursor *QXcbScreen::cursor() const
{
return m_cursor;
@@ -457,6 +464,8 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation)
}
free(workArea);
+ qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4);
+ m_pixelDensity = qRound(dpi/96);
m_geometry = QRect(xGeometry.topLeft(), xGeometry.size());
m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size());
m_availableGeometry = QRect(xAvailableGeometry.topLeft(), xAvailableGeometry.size());