summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandscreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/qwaylandscreen.cpp')
-rw-r--r--src/client/qwaylandscreen.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index 6e48c442e..675c84042 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -59,6 +59,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin
, m_outputId(id)
, mWaylandDisplay(waylandDisplay)
, mExtendedOutput(0)
+ , mScale(1)
, mDepth(32)
, mRefreshRate(60000)
, mTransform(-1)
@@ -83,7 +84,9 @@ QWaylandDisplay * QWaylandScreen::display() const
QRect QWaylandScreen::geometry() const
{
- return mGeometry;
+ // Scale geometry for QScreen. This makes window and screen
+ // geometry be in the same coordinate system.
+ return QRect(mGeometry.topLeft(), mGeometry.size() / mScale);
}
int QWaylandScreen::depth() const
@@ -127,6 +130,16 @@ Qt::ScreenOrientation QWaylandScreen::orientation() const
return m_orientation;
}
+int QWaylandScreen::scale() const
+{
+ return mScale;
+}
+
+qreal QWaylandScreen::devicePixelRatio() const
+{
+ return qreal(mScale);
+}
+
qreal QWaylandScreen::refreshRate() const
{
return mRefreshRate / 1000.f;
@@ -188,6 +201,11 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
mGeometry.moveTopLeft(QPoint(x, y));
}
+void QWaylandScreen::output_scale(int32_t factor)
+{
+ mScale = factor;
+}
+
void QWaylandScreen::output_done()
{
// the done event is sent after all the geometry and the mode events are sent,