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
59{
61
65
66 // For objects version 3 onwards, zxdg_output_v1.done is deprecated.
69 }
70 return ret;
71}
72
88
97
99{
100 return mWaylandDisplay;
101}
102
104{
105 return mManufacturer;
106}
107
109{
110 return mModel;
111}
112
114{
116
117 // Workaround for Gnome bug
118 // https://gitlab.gnome.org/GNOME/mutter/-/issues/2631
119 // which sends an incorrect xdg geometry
120 const bool xdgGeometryIsBogus = mScale > 1 && mXdgGeometry.size() == mGeometry.size();
121
122 if (!xdgGeometryIsBogus) {
123 return mXdgGeometry;
124 }
125 }
126 // Scale geometry for QScreen. This makes window and screen
127 // geometry be in the same coordinate system.
129}
130
132{
133 return mDepth;
134}
135
137{
138 return mFormat;
139}
140
142{
145 else
146 return mPhysicalSize;
147}
148
150{
151 static bool physicalDpi = qEnvironmentVariable("QT_WAYLAND_FORCE_DPI") == QStringLiteral("physical");
152 if (physicalDpi)
153 return QPlatformScreen::logicalDpi();
154
155 static int forceDpi = qgetenv("QT_WAYLAND_FORCE_DPI").toInt();
156 if (forceDpi)
157 return QDpi(forceDpi, forceDpi);
158
159 return QDpi(96, 96);
160}
161
163{
167
168 list.reserve(screens.size() + (placeholder ? 1 : 0));
169
171 if (screen->screen())
172 list << screen;
173 }
174
175 if (placeholder)
176 list << placeholder;
177
178 return list;
179}
180
185
187{
188 return mScale;
189}
190
192{
193 return qreal(mScale);
194}
195
197{
198 return mRefreshRate / 1000.f;
199}
200
201#if QT_CONFIG(cursor)
203{
205}
206#endif // QT_CONFIG(cursor)
207
233
241
243{
244 if (auto *o = QtWayland::wl_output::fromObject(output))
245 return static_cast<QWaylandScreen *>(o);
246 return nullptr;
247}
248
277
279{
281 return;
282
284 if (size != mGeometry.size())
286
287 if (refresh != mRefreshRate)
289}
290
307
312
325
327{
329 qCWarning(lcQpaWayland) << "wl_output.name received after output has been initialized, this is most likely a bug in the compositor";
330 return;
331 }
332
334 qCWarning(lcQpaWayland) << "wl_output.name received more than once, this is most likely a bug in the compositor";
335 return;
336 }
337
338 if (!name.isEmpty())
340
342}
343
362
363
368
373
375{
377 qCWarning(lcQpaWayland) << "zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor";
378
380 if (mInitialized)
382 else
384}
385
387{
389 qCWarning(lcQpaWayland) << "zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor";
390
392 qCWarning(lcQpaWayland) << "zxdg_output_v1.name received more than once, this is most likely a bug in the compositor";
393 return;
394 }
395
396 // This event is deprecated, instead clients should use wl_output.name.
398 if (!name.isEmpty())
400 }
401
403}
404
411
412} // namespace QtWaylandClient
413
414QT_END_NAMESPACE
Combined button and popup list for selecting options.