1 | /* |
2 | SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #pragma once |
8 | |
9 | #include <QWindow> |
10 | |
11 | #include <QGuiApplication> |
12 | #include <qpa/qplatformnativeinterface.h> |
13 | |
14 | struct wl_surface; |
15 | |
16 | inline wl_surface *surfaceForWindow(QWindow *window) |
17 | { |
18 | if (!window) { |
19 | return nullptr; |
20 | } |
21 | |
22 | QPlatformNativeInterface *native = qGuiApp->platformNativeInterface(); |
23 | if (!native) { |
24 | return nullptr; |
25 | } |
26 | window->create(); |
27 | return reinterpret_cast<wl_surface *>(native->nativeResourceForWindow(QByteArrayLiteral("surface" ), window)); |
28 | } |
29 | |