1// Copyright (C) 2017 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 "qwaylandwlshellintegration_p.h"
5#include "qwaylandwlshellsurface_p.h"
6
7#include <QtWaylandClient/private/qwaylandwindow_p.h>
8#include <QtWaylandClient/private/qwaylanddisplay_p.h>
9
10QT_BEGIN_NAMESPACE
11
12namespace QtWaylandClient {
13
14QWaylandWlShellIntegration::QWaylandWlShellIntegration() : QWaylandShellIntegrationTemplate(1)
15{
16 qCWarning(lcQpaWayland) << "\"wl-shell\" is a deprecated shell extension, prefer using"
17 << "\"xdg-shell\" if supported by the compositor"
18 << "by setting the environment variable QT_WAYLAND_SHELL_INTEGRATION";
19}
20
21QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
22{
23 return new QWaylandWlShellSurface(get_shell_surface(window->wlSurface()), window);
24}
25
26void *QWaylandWlShellIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
27{
28 QByteArray lowerCaseResource = resource.toLower();
29 if (lowerCaseResource == "wl_shell_surface") {
30 if (auto waylandWindow = static_cast<QWaylandWindow *>(window->handle())) {
31 if (auto shellSurface = qobject_cast<QWaylandWlShellSurface *>(object: waylandWindow->shellSurface())) {
32 return shellSurface->object();
33 }
34 }
35 }
36 return nullptr;
37}
38
39} // namespace QtWaylandClient
40
41QT_END_NAMESPACE
42

source code of qtwayland/src/plugins/shellintegration/wl-shell/qwaylandwlshellintegration.cpp