11#include <QtGui/QGuiApplication>
13#include <qpa/qwindowsysteminterface.h>
14#include <qpa/qplatformwindow.h>
31 :
QtWayland::wl_output(waylandDisplay->wl_registry(),
id,
qMin(version, 3))
33 , mWaylandDisplay(waylandDisplay)
36 if (
auto *xdgOutputManager = waylandDisplay->xdgOutputManager())
39 if (version < WL_OUTPUT_DONE_SINCE_VERSION) {
40 qCWarning(lcQpaWayland) <<
"wl_output done event not supported by compositor,"
41 <<
"QScreen may not work correctly";
50 if (zxdg_output_v1::isInitialized())
51 zxdg_output_v1::destroy();
52 if (wl_output::version() >= WL_OUTPUT_RELEASE_SINCE_VERSION)
55 wl_output_destroy(wl_output::object());
84 if (zxdg_output_v1::isInitialized())
91 if (zxdg_output_v1::isInitialized())
94 zxdg_output_v1::init(xdgOutputManager->get_xdg_output(wl_output::object()));
114 if (zxdg_output_v1::isInitialized()) {
147 static int forceDpi =
qgetenv(
"QT_WAYLAND_FORCE_DPI").toInt();
149 return QDpi(forceDpi, forceDpi);
156 QList<QPlatformScreen *>
list;
160 list.
reserve(screens.size() + (placeholder ? 1 : 0));
215 case wl_output::subpixel_unknown:
216 case wl_output::subpixel_none:
219 case wl_output::subpixel_horizontal_rgb:
222 case wl_output::subpixel_horizontal_bgr:
225 case wl_output::subpixel_vertical_rgb:
228 case wl_output::subpixel_vertical_bgr:
246 if (
auto *
o = QtWayland::wl_output::fromObject(
output))
256 switch (wlTransform) {
257 case WL_OUTPUT_TRANSFORM_NORMAL:
260 case WL_OUTPUT_TRANSFORM_90:
263 case WL_OUTPUT_TRANSFORM_180:
266 case WL_OUTPUT_TRANSFORM_270:
270 case WL_OUTPUT_TRANSFORM_FLIPPED:
271 case WL_OUTPUT_TRANSFORM_FLIPPED_90:
272 case WL_OUTPUT_TRANSFORM_FLIPPED_180:
273 case WL_OUTPUT_TRANSFORM_FLIPPED_270:
282 if (!(
flags & WL_OUTPUT_MODE_CURRENT))
321 if (zxdg_output_v1::isInitialized())
341 if (!zxdg_output_v1::isInitialized())
359 qWarning(lcQpaWayland) <<
"zxdg_output_v1.done received on version 3 or newer, this is most likely a bug in the compositor";
371 qWarning(lcQpaWayland) <<
"zxdg_output_v1.name received after output has been initialized, this is most likely a bug in the compositor";
379 Q_ASSERT(zxdg_output_v1::isInitialized());
Format
The following image formats are available in Qt.
void reserve(qsizetype size)
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr void moveTopLeft(const QPoint &p) noexcept
Moves the rectangle, leaving the top-left corner at the given position.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QWaylandXdgOutputManagerV1()
Constructs a QWaylandXdgOutputManagerV1 object.
static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry, const QRect &newAvailableGeometry)
static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation)
static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate)
QPlatformPlaceholderScreen * placeholderScreen() const
void handleScreenInitialized(QWaylandScreen *screen)
QWaylandXdgOutputManagerV1 * xdgOutputManager() const
QList< QWaylandScreen * > screens() const
void zxdg_output_v1_name(const QString &name) override
void zxdg_output_v1_done() override
QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
QWindow * topLevelAt(const QPoint &point) const override
Return the given top level window for a given position.
void output_mode(uint32_t flags, int width, int height, int refresh) override
uint requiredEvents() const
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
void output_geometry(int32_t x, int32_t y, int32_t width, int32_t height, int subpixel, const QString &make, const QString &model, int32_t transform) override
QString manufacturer() const override
Reimplement this function in subclass to return the manufacturer of this screen.
QWaylandDisplay * display() const
void initXdgOutput(QWaylandXdgOutputManagerV1 *xdgOutputManager)
void output_scale(int32_t factor) override
~QWaylandScreen() override
int depth() const override
Reimplement in subclass to return current depth of the screen.
void output_done() override
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
void updateOutputProperties()
QString model() const override
Reimplement this function in subclass to return the model of this screen.
QWaylandDisplay * mWaylandDisplay
void updateXdgOutputProperties()
QString name() const override
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
static QWaylandScreen * waylandScreenFromWindow(QWindow *window)
void zxdg_output_v1_logical_position(int32_t x, int32_t y) override
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
::wl_output * output() const override
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
static QWaylandScreen * fromWlOutput(::wl_output *output)
QList< QPlatformScreen * > virtualSiblings() const override
Returns a list of all the platform screens that are part of the same virtual desktop.
void zxdg_output_v1_logical_size(int32_t width, int32_t height) override
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
Qt::ScreenOrientation m_orientation
SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override
Returns a hint about this screen's subpixel layout structure.
Qt::ScreenOrientation toScreenOrientation(int wlTransform, Qt::ScreenOrientation fallback) const
static bool fixedToplevelPositions
~QWaylandXdgOutputManagerV1()
struct wl_display * display
Combined button and popup list for selecting options.
@ InvertedLandscapeOrientation
@ InvertedPortraitOrientation
QPair< qreal, qreal > QDpi
#define qCWarning(category,...)
constexpr const T & qMin(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLenum GLenum transform
#define QStringLiteral(str)
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QT_BEGIN_NAMESPACE typedef uchar * output
QSqlQueryModel * model
[16]