Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandscreen.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
10
11#include <QtGui/QGuiApplication>
12
13#include <qpa/qwindowsysteminterface.h>
14#include <qpa/qplatformwindow.h>
15
17
18namespace QtWaylandClient {
19
24
29
32 , m_outputId(id)
34 , mOutputName(QStringLiteral("Screen%1").arg(id))
35{
38
40 qCWarning(lcQpaWayland) << "wl_output done event not supported by compositor,"
41 << "QScreen may not work correctly";
42 mWaylandDisplay->forceRoundTrip(); // Give the compositor a chance to send geometry etc.
43 mProcessedEvents |= OutputDoneEvent; // Fake the done event
45 }
46}
47
57
71
87
96
101
103{
104 return mManufacturer;
105}
106
108{
109 return mModel;
110}
111
113{
115
116 // Workaround for Gnome bug
117 // https://gitlab.gnome.org/GNOME/mutter/-/issues/2631
118 // which sends an incorrect xdg geometry
119 const bool xdgGeometryIsBogus = mScale > 1 && mXdgGeometry.size() == mGeometry.size();
120
121 if (!xdgGeometryIsBogus) {
122 return mXdgGeometry;
123 }
124 }
125 // Scale geometry for QScreen. This makes window and screen
126 // geometry be in the same coordinate system.
128}
129
131{
132 return mDepth;
133}
134
136{
137 return mFormat;
138}
139
141{
144 else
145 return mPhysicalSize;
146}
147
149{
150 static bool physicalDpi = qEnvironmentVariable("QT_WAYLAND_FORCE_DPI") == QStringLiteral("physical");
151 if (physicalDpi)
152 return QPlatformScreen::logicalDpi();
153
154 static int forceDpi = qgetenv("QT_WAYLAND_FORCE_DPI").toInt();
155 if (forceDpi)
156 return QDpi(forceDpi, forceDpi);
157
158 return QDpi(96, 96);
159}
160
162{
166
167 list.reserve(screens.size() + (placeholder ? 1 : 0));
168
170 if (screen->screen())
171 list << screen;
172 }
173
174 if (placeholder)
175 list << placeholder;
176
177 return list;
178}
179
184
186{
187 return mScale;
188}
189
191{
192 return qreal(mScale);
193}
194
196{
197 return mRefreshRate / 1000.f;
198}
199
200#if QT_CONFIG(cursor)
202{
204}
205#endif // QT_CONFIG(cursor)
206
232
240
242{
243 if (auto *o = QtWayland::wl_output::fromObject(output))
244 return static_cast<QWaylandScreen *>(o);
245 return nullptr;
246}
247
276
278{
280 return;
281
283 if (size != mGeometry.size())
285
286 if (refresh != mRefreshRate)
288}
289
306
311
324
341
342
347
352
354{
356 qCWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor";
357
359 if (mInitialized)
361 else
363}
364
366{
368 qCWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor";
369
372}
373
379
380} // namespace QtWaylandClient
381
382QT_END_NAMESPACE
Combined button and popup list for selecting options.