@@ -11,56 +11,44 @@ index a4f8757e..68938a4a 100644
11
11
return scale;
12
12
}
13
13
14
- diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
15
- index 88a2fa7e..604ccff0 100644
16
- --- a/src/client/qwaylandintegration.cpp
17
- +++ b/src/client/qwaylandintegration.cpp
18
- @@ -36,6 +36,7 @@
19
- #include <QtGui/QOpenGLContext>
20
- #endif // QT_CONFIG(opengl)
21
- #include <QSocketNotifier>
22
- + #include <QTimer>
23
-
24
- #include <qpa/qplatforminputcontextfactory_p.h>
25
- #include <qpa/qplatformaccessibility.h>
26
14
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
27
- index 7c4f1bdf..c4efe3d6 100644
15
+ index 7c4f1bdf..e0afd4d5 100644
28
16
--- a/src/client/qwaylandscreen.cpp
29
17
+++ b/src/client/qwaylandscreen.cpp
30
- @@ -168,7 +168,7 @@ Qt::ScreenOrientation QWaylandScreen::orientation() const
18
+ @@ -168,14 +168,16 @@ Qt::ScreenOrientation QWaylandScreen::orientation() const
31
19
return m_orientation;
32
20
}
33
21
34
22
- int QWaylandScreen::scale() const
35
23
+ qreal QWaylandScreen::scale() const
36
24
{
37
- return mScale;
25
+ - return mScale;
26
+ + return devicePixelRatio();
38
27
}
39
- @@ -238,7 +238,8 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
40
28
41
- void QWaylandScreen::output_scale(int32_t factor)
29
+ qreal QWaylandScreen::devicePixelRatio() const
42
30
{
43
- - mScale = factor;
44
- + if (!zxdg_output_v1::isInitialized() || !mWaylandDisplay->fractionalScaleManager())
45
- + mScale = factor;
31
+ - return qreal(mScale);
32
+ + return (mWaylandDisplay->fractionalScaleManager() && std::fmod(mFractionalScale, qreal(1)) != 0)
33
+ + ? mFractionalScale
34
+ + : qreal(mScale);
46
35
}
47
36
48
- void QWaylandScreen::output_done()
49
- @@ -324,7 +325,12 @@ void QWaylandScreen::zxdg_output_v1_name(const QString &name)
37
+ qreal QWaylandScreen::refreshRate() const
38
+ @@ -324,7 +326,11 @@ void QWaylandScreen::zxdg_output_v1_name(const QString &name)
50
39
void QWaylandScreen::updateXdgOutputProperties()
51
40
{
52
41
Q_ASSERT(zxdg_output_v1::isInitialized());
53
- + if (mWaylandDisplay->fractionalScaleManager())
54
- + mScale = (qreal(mGeometry.width()) / qreal(mXdgGeometry.width())
55
- + + qreal(mGeometry.height()) / qreal(mXdgGeometry.height())) * qreal(0.5);
42
+ + mFractionalScale = (qreal(mGeometry.width()) / qreal(mXdgGeometry.width())
43
+ + + qreal(mGeometry.height()) / qreal(mXdgGeometry.height())) * qreal(0.5);
56
44
+ const QDpi dpi = logicalDpi();
57
45
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), geometry());
58
46
+ QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), dpi.first, dpi.second);
59
47
}
60
48
61
49
} // namespace QtWaylandClient
62
50
diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h
63
- index 4499f0ee..10efc284 100644
51
+ index 4499f0ee..f1e761e7 100644
64
52
--- a/src/client/qwaylandscreen_p.h
65
53
+++ b/src/client/qwaylandscreen_p.h
66
54
@@ -63,7 +63,7 @@ public:
@@ -72,12 +60,11 @@ index 4499f0ee..10efc284 100644
72
60
qreal devicePixelRatio() const override;
73
61
qreal refreshRate() const override;
74
62
75
- @@ -114,7 +114,7 @@ protected:
76
- QString mModel;
63
+ @@ -115,6 +115,7 @@ protected:
77
64
QRect mGeometry;
78
65
QRect mXdgGeometry;
79
- - int mScale = 1;
80
- + qreal mScale = 1;
66
+ int mScale = 1;
67
+ + qreal mFractionalScale = 1;
81
68
int mDepth = 32;
82
69
int mRefreshRate = 60000;
83
70
int mTransform = -1;
0 commit comments