aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edmundson <[email protected]>2017-03-25 12:16:46 +0000
committerDavid Edmundson <[email protected]>2017-04-28 10:23:14 +0100
commit8ef184e1cd1b2f479b88015e22cb365c1d517887 (patch)
treea04e356046b7cdb884d4bfbe505191da22baa832
parent44a6050e839dc6311132010056ec5218680aea50 (diff)
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
-rw-r--r--plugins/qpa/screen.cpp7
-rw-r--r--plugins/qpa/screen.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/plugins/qpa/screen.cpp b/plugins/qpa/screen.cpp
index 290e1ed..e8cd85e 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 879ad06..7690e1f 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<KWayland::Client::Output> m_output;