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
qwaylandoutput_p.h
Go to the documentation of this file.
1// Copyright (C) 2017-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
3// Copyright (C) 2017 The Qt Company Ltd.
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
5// Qt-Security score:critical reason:network-protocol
6
7#ifndef QWAYLANDOUTPUT_P_H
8#define QWAYLANDOUTPUT_P_H
9
10//
11// W A R N I N G
12// -------------
13//
14// This file is not part of the Qt API. It exists purely as an
15// implementation detail. This header file may change from version to
16// version without notice, or even be removed.
17//
18// We mean it.
19//
20
21#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
22#include <QtWaylandCompositor/QWaylandOutput>
23#include <QtWaylandCompositor/QWaylandClient>
24#include <QtWaylandCompositor/QWaylandSurface>
25#include <QtWaylandCompositor/QWaylandXdgOutputV1>
26
27#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
28
29#include <QtCore/QList>
30#include <QtCore/QRect>
31
32#include <QtCore/private/qobject_p.h>
33#include <QtCore/qpointer.h>
34
36
38{
41
42 QWaylandSurfaceViewMapper(QWaylandSurface *s, QWaylandView *v)
43 : surface(s)
44 , views(1, v)
45 {}
46
47 QWaylandView *maybePrimaryView() const
48 {
49 QWaylandView *primaryView = surface != nullptr ? surface->primaryView() : nullptr;
50 if (views.contains(primaryView))
51 return primaryView;
52 return nullptr;
53 }
54
55 QWaylandSurface *surface = nullptr;
57 bool has_entered = false;
58};
59
60class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutputPrivate : public QObjectPrivate, public QtWaylandServer::wl_output
61{
62public:
63 Q_DECLARE_PUBLIC(QWaylandOutput)
64
65 QWaylandOutputPrivate();
66
67 ~QWaylandOutputPrivate() override;
68 static QWaylandOutputPrivate *get(QWaylandOutput *output) { return output->d_func(); }
69
70 void addView(QWaylandView *view, QWaylandSurface *surface);
71 void removeView(QWaylandView *view, QWaylandSurface *surface);
72
73 void sendGeometry(const Resource *resource);
74 void sendGeometryInfo();
75
76 void sendMode(const Resource *resource, const QWaylandOutputMode &mode);
77 void sendModesInfo();
78 void sendDone();
79 void maybeSendDone(const Resource *resource);
80 void maybeSendScale(const Resource *resource, int scale);
81
82 void handleWindowPixelSizeChanged();
83
84protected:
85 void output_bind_resource(Resource *resource) override;
86
87private:
88 void _q_handleMaybeWindowPixelSizeChanged();
89 void _q_handleWindowDestroyed();
90
91 QWaylandCompositor *compositor = nullptr;
92 QWindow *window = nullptr;
93 QString manufacturer;
94 QString model;
95 QPoint position;
96 QList<QWaylandOutputMode> modes;
97 int currentMode = -1;
98 int preferredMode = -1;
99 QRect availableGeometry;
100 QList<QWaylandSurfaceViewMapper> surfaceViews;
101 QSize physicalSize;
102 QWaylandOutput::Subpixel subpixel = QWaylandOutput::SubpixelUnknown;
103 QWaylandOutput::Transform transform = QWaylandOutput::TransformNormal;
104 int scaleFactor = 1;
105 bool sizeFollowsWindow = false;
106 bool initialized = false;
107 bool canSendFrameCallbacks = false;
108 QSize windowPixelSize;
109
110 Q_DISABLE_COPY(QWaylandOutputPrivate)
111
112 friend class QWaylandXdgOutputManagerV1Private;
113};
114
115
116QT_END_NAMESPACE
117
118#endif /*QWAYLANDOUTPUT_P_H*/
\qmltype WaylandOutput \nativetype QWaylandOutput \inqmlmodule QtWayland.Compositor
Combined button and popup list for selecting options.
static QtWaylandServer::wl_output::transform toWlTransform(const QWaylandOutput::Transform &value)
static QT_BEGIN_NAMESPACE QtWaylandServer::wl_output::subpixel toWlSubpixel(const QWaylandOutput::Subpixel &value)
QWaylandView * maybePrimaryView() const
QList< QWaylandView * > views
QWaylandSurfaceViewMapper(QWaylandSurface *s, QWaylandView *v)