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
6#ifndef QWAYLANDOUTPUT_P_H
7#define QWAYLANDOUTPUT_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
21#include <QtWaylandCompositor/QWaylandOutput>
22#include <QtWaylandCompositor/QWaylandClient>
23#include <QtWaylandCompositor/QWaylandSurface>
24#include <QtWaylandCompositor/QWaylandXdgOutputV1>
25
26#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
27
28#include <QtCore/QList>
29#include <QtCore/QRect>
30
31#include <QtCore/private/qobject_p.h>
32#include <QtCore/qpointer.h>
33
35
37{
40
41 QWaylandSurfaceViewMapper(QWaylandSurface *s, QWaylandView *v)
42 : surface(s)
43 , views(1, v)
44 {}
45
46 QWaylandView *maybePrimaryView() const
47 {
48 QWaylandView *primaryView = surface != nullptr ? surface->primaryView() : nullptr;
49 if (views.contains(primaryView))
50 return primaryView;
51 return nullptr;
52 }
53
54 QWaylandSurface *surface = nullptr;
56 bool has_entered = false;
57};
58
59class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandOutputPrivate : public QObjectPrivate, public QtWaylandServer::wl_output
60{
61public:
62 Q_DECLARE_PUBLIC(QWaylandOutput)
63
64 QWaylandOutputPrivate();
65
66 ~QWaylandOutputPrivate() override;
67 static QWaylandOutputPrivate *get(QWaylandOutput *output) { return output->d_func(); }
68
69 void addView(QWaylandView *view, QWaylandSurface *surface);
70 void removeView(QWaylandView *view, QWaylandSurface *surface);
71
72 void sendGeometry(const Resource *resource);
73 void sendGeometryInfo();
74
75 void sendMode(const Resource *resource, const QWaylandOutputMode &mode);
76 void sendModesInfo();
77 void sendDone();
78 void maybeSendDone(const Resource *resource);
79 void maybeSendScale(const Resource *resource, int scale);
80
81 void handleWindowPixelSizeChanged();
82
83protected:
84 void output_bind_resource(Resource *resource) override;
85
86private:
87 void _q_handleMaybeWindowPixelSizeChanged();
88 void _q_handleWindowDestroyed();
89
90 QWaylandCompositor *compositor = nullptr;
91 QWindow *window = nullptr;
92 QString manufacturer;
93 QString model;
94 QPoint position;
95 QList<QWaylandOutputMode> modes;
96 int currentMode = -1;
97 int preferredMode = -1;
98 QRect availableGeometry;
99 QList<QWaylandSurfaceViewMapper> surfaceViews;
100 QSize physicalSize;
101 QWaylandOutput::Subpixel subpixel = QWaylandOutput::SubpixelUnknown;
102 QWaylandOutput::Transform transform = QWaylandOutput::TransformNormal;
103 int scaleFactor = 1;
104 bool sizeFollowsWindow = false;
105 bool initialized = false;
106 bool canSendFrameCallbacks = false;
107 QSize windowPixelSize;
108
109 Q_DISABLE_COPY(QWaylandOutputPrivate)
110
111 friend class QWaylandXdgOutputManagerV1Private;
112};
113
114
115QT_END_NAMESPACE
116
117#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)