From 8ef184e1cd1b2f479b88015e22cb365c1d517887 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sat, 25 Mar 2017 12:16:46 +0000 Subject: [PATCH] Implement high DPI support in KWin QPA Summary: Basically just a copy and paste from the relevant Qt Wayland parts. Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D5172 --- plugins/qpa/screen.cpp | 7 ++++++- plugins/qpa/screen.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/qpa/screen.cpp b/plugins/qpa/screen.cpp index 290e1eda0e..e8cd85e4f5 100644 --- a/plugins/qpa/screen.cpp +++ b/plugins/qpa/screen.cpp @@ -50,7 +50,7 @@ QImage::Format Screen::format() const QRect Screen::geometry() const { - return m_output ? m_output->geometry() : QRect(0, 0, 1, 1); + return m_output ? QRect(m_output->globalPosition(), m_output->pixelSize() / m_output->scale()) : QRect(0, 0, 1, 1); } QSizeF Screen::physicalSize() const @@ -73,5 +73,10 @@ QDpi Screen::logicalDpi() const return QPlatformScreen::logicalDpi(); } +qreal Screen::devicePixelRatio() const +{ + return m_output ? (qreal)m_output->scale() : 1.0; +} + } } diff --git a/plugins/qpa/screen.h b/plugins/qpa/screen.h index 879ad06a27..7690e1f6bc 100644 --- a/plugins/qpa/screen.h +++ b/plugins/qpa/screen.h @@ -49,6 +49,7 @@ public: QSizeF physicalSize() const override; QPlatformCursor *cursor() const override; QDpi logicalDpi() const override; + qreal devicePixelRatio() const override; private: QPointer m_output;