1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include <QtQml/qqmlextensionplugin.h>
5#include <QtQml/qqml.h>
6
7#include <QtWaylandCompositor/QWaylandQuickExtension>
8#include <QtWaylandCompositor/QWaylandXdgShell>
9#include <QtWaylandCompositor/QWaylandXdgDecorationManagerV1>
10#include <QtWaylandCompositor/QWaylandQuickXdgOutputV1>
11
12QT_BEGIN_NAMESPACE
13
14Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShell)
15Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgDecorationManagerV1)
16Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgOutputManagerV1)
17
18/*!
19 \qmlmodule QtWayland.Compositor.XdgShell
20 \title Qt Wayland XdgShell Extension
21 \ingroup qmlmodules
22 \brief Provides a Qt API for the XdgShell shell extension.
23
24 \section2 Summary
25 XdgShell is a shell extension providing window system features typical to
26 desktop systems.
27
28 XdgShell corresponds to the Wayland interface, \c xdg_shell.
29
30 \section2 Usage
31 To use this module, import it like this:
32 \qml
33 import QtWayland.Compositor.XdgShell
34 \endqml
35*/
36
37class QWaylandCompositorXdgShellPlugin : public QQmlExtensionPlugin
38{
39 Q_OBJECT
40 Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
41public:
42 void registerTypes(const char *uri) override
43 {
44 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWayland.Compositor.XdgShell"));
45 defineModule(uri);
46 }
47
48 static void defineModule(const char *uri)
49 {
50 qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
51
52 qmlRegisterType<QWaylandXdgShellQuickExtension>(uri, versionMajor: 1, versionMinor: 3, qmlName: "XdgShell");
53 qmlRegisterType<QWaylandXdgSurface>(uri, versionMajor: 1, versionMinor: 3, qmlName: "XdgSurface");
54 qmlRegisterUncreatableType<QWaylandXdgToplevel>(uri, versionMajor: 1, versionMinor: 3, qmlName: "XdgToplevel", reason: QObject::tr(s: "Cannot create instance of XdgShellToplevel"));
55 qmlRegisterUncreatableType<QWaylandXdgPopup>(uri, versionMajor: 1, versionMinor: 3, qmlName: "XdgPopup", reason: QObject::tr(s: "Cannot create instance of XdgShellPopup"));
56
57 qmlRegisterType<QWaylandXdgDecorationManagerV1QuickExtension>(uri, versionMajor: 1, versionMinor: 3, qmlName: "XdgDecorationManagerV1");
58 qmlRegisterType<QWaylandXdgOutputManagerV1QuickExtension>(uri, versionMajor: 1, versionMinor: 14, qmlName: "XdgOutputManagerV1");
59 qmlRegisterType<QWaylandQuickXdgOutputV1>(uri, versionMajor: 1, versionMinor: 14, qmlName: "XdgOutputV1");
60 }
61};
62
63QT_END_NAMESPACE
64
65#include "qwaylandcompositorxdgshellplugin.moc"
66

source code of qtwayland/src/imports/compositor-extensions/xdgshell/qwaylandcompositorxdgshellplugin.cpp