1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qwaylandshellsurface_p.h" |
5 | |
6 | /*! |
7 | * \class QWaylandShellSurfaceTemplate |
8 | * \inmodule QtWaylandCompositor |
9 | * \since 5.8 |
10 | * \brief QWaylandShellSurfaceTemplate is a convenience class for creating custom shell surface |
11 | * classes. |
12 | * |
13 | * QWaylandShellSurfaceTemplate is a template class which inherits from QWaylandShellSurface and |
14 | * is convenience for building custom shell extensions. |
15 | * |
16 | * It provides the connection between Qt Wayland Compositor and the class generated by |
17 | * \c qtwaylandscanner, based on the XML description of the extension protocol. |
18 | * |
19 | * It provides two specific pieces of convenience: |
20 | * \list |
21 | * \li A reimplementation of \l{QWaylandCompositorExtension::extensionInterface()} which returns |
22 | * the \c wl_interface pointer for the qtwaylandscanner-generated base class. |
23 | * \li A static \l{findIn()} function which searches for an instance of the extension in a |
24 | * provided container, and returns this if it is found. |
25 | * \endlist |
26 | * |
27 | * The same usage pattern applies as for QWaylandCompositorExtensionTemplate. |
28 | * |
29 | * \sa { Custom Shell} |
30 | */ |
31 | |
32 | /*! |
33 | * \fn template <typename T> T *QWaylandShellSurfaceTemplate<T>::findIn(QWaylandObject *container) |
34 | * |
35 | * If any instance of the interface has been registered with \a container, this is returned. |
36 | * Otherwise null is returned. The look-up is based on the generated \c interfaceName() which |
37 | * matches the interface name in the protocol description. |
38 | */ |
39 | |
40 | |
41 | /*! |
42 | * \qmltype ShellSurface |
43 | * \nativetype QWaylandShellSurface |
44 | * \inqmlmodule QtWayland.Compositor |
45 | * \since 5.8 |
46 | * \brief Provides a common interface for surface roles specified by shell extensions. |
47 | * |
48 | * This interface represents a Wayland surface role given by a Wayland protocol extension that |
49 | * defines how the WaylandSurface should map onto the screen. |
50 | * |
51 | * \note Even though this type contains a very limited API, the properties and signals of the |
52 | * implementations are named consistently. For example, if you're only using desktop shell |
53 | * extensions in your compositor, it's safe to access properties such as title, maximized, etc. |
54 | * directly on the ShellSurface. See the various implementations for additional properties and |
55 | * signals. |
56 | * |
57 | * \sa WaylandSurface, ShellSurfaceItem, WlShellSurface, IviSurface |
58 | */ |
59 | |
60 | /*! |
61 | * \class QWaylandShellSurface |
62 | * \inmodule QtWaylandCompositor |
63 | * \since 5.8 |
64 | * \brief The QWaylandShellSurface class is a common interface for surface roles specified by shell extensions. |
65 | * |
66 | * This interface represents a Wayland surface role given by a Wayland protocol extension that |
67 | * defines how the QWaylandSurface should map onto the screen. |
68 | * |
69 | * \sa QWaylandSurface, QWaylandWlShellSurface, QWaylandIviSurface, QWaylandShellSurfaceTemplate |
70 | */ |
71 | |
72 | #if QT_CONFIG(wayland_compositor_quick) |
73 | /*! |
74 | * \fn QWaylandQuickShellIntegration *QWaylandShellSurface::createIntegration(QWaylandQuickShellSurfaceItem *item) |
75 | * |
76 | * Creates a QWaylandQuickShellIntegration for this QWaylandQuickShellSurface. It's called |
77 | * automatically when \a {item}'s \l {QWaylandQuickShellSurfaceItem::}{shellSurface} is assigned. |
78 | * |
79 | * \sa QWaylandQuickShellSurfaceItem |
80 | */ |
81 | #endif |
82 | |
83 | /*! |
84 | * \qmlproperty enum QtWayland.Compositor::ShellSurface::windowType |
85 | * |
86 | * This property holds the window type of the ShellSurface. |
87 | */ |
88 | |
89 | /*! |
90 | * \property QWaylandShellSurface::windowType |
91 | * |
92 | * This property holds the window type of the QWaylandShellSurface. |
93 | */ |
94 | |
95 | /*! |
96 | * \qmlproperty bool QtWayland.Compositor::ShellSurface::modal |
97 | * |
98 | * This property is true if the ShellSurface represents a modal dialog. |
99 | * \since 6.8 |
100 | */ |
101 | |
102 | /*! |
103 | * \property QWaylandShellSurface::modal |
104 | * |
105 | * This property is true if the ShellSurface represents a modal dialog. |
106 | * \since 6.8 |
107 | */ |
108 | |
109 | QT_BEGIN_NAMESPACE |
110 | |
111 | QWaylandShellSurface::QWaylandShellSurface(QWaylandShellSurfacePrivate &dd) |
112 | : QWaylandCompositorExtension(dd) |
113 | { |
114 | } |
115 | |
116 | QWaylandShellSurface::QWaylandShellSurface(QWaylandObject *container, QWaylandShellSurfacePrivate &dd) |
117 | : QWaylandCompositorExtension(container, dd) |
118 | { |
119 | } |
120 | |
121 | QWaylandShellSurface::QWaylandShellSurface(QWaylandObject *waylandObject) |
122 | : QWaylandCompositorExtension(waylandObject, *new QWaylandShellSurfacePrivate) |
123 | { |
124 | } |
125 | |
126 | bool QWaylandShellSurface::isModal() const |
127 | { |
128 | Q_D(const QWaylandShellSurface); |
129 | return d->modal; |
130 | } |
131 | |
132 | void QWaylandShellSurface::setModal(bool newModal) |
133 | { |
134 | Q_D(QWaylandShellSurface); |
135 | if (d->modal == newModal) |
136 | return; |
137 | d->modal = newModal; |
138 | emit modalChanged(); |
139 | } |
140 | |
141 | QT_END_NAMESPACE |
142 | |
143 | #include "moc_qwaylandshellsurface.cpp" |
144 | |