| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include <qpa/qplatformintegrationplugin.h> |
| 5 | #include <QtWaylandClient/private/qwaylandintegration_p.h> |
| 6 | #include <QtWaylandClient/private/qtwaylandclientglobal_p.h> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | namespace QtWaylandClient { |
| 11 | |
| 12 | class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland.json") |
| 16 | public: |
| 17 | QPlatformIntegration *create(const QString&, const QStringList&) override; |
| 18 | }; |
| 19 | |
| 20 | QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList) |
| 21 | { |
| 22 | Q_UNUSED(paramList) |
| 23 | #if !QT_CONFIG(wayland_egl) |
| 24 | if (system == "wayland-egl") |
| 25 | return nullptr; |
| 26 | #endif |
| 27 | #if !QT_CONFIG(wayland_brcm) |
| 28 | if (system == "wayland-brcm") |
| 29 | return nullptr; |
| 30 | #endif |
| 31 | auto *integration = new QWaylandIntegration(system); |
| 32 | |
| 33 | if (!integration->init()) { |
| 34 | delete integration; |
| 35 | integration = nullptr; |
| 36 | } |
| 37 | |
| 38 | return integration; |
| 39 | } |
| 40 | |
| 41 | } // namespace QtWaylandClient |
| 42 | |
| 43 | QT_END_NAMESPACE |
| 44 | |
| 45 | #include "main.moc" |
| 46 |
