File indexing completed on 2024-05-12 04:00:24

0001 /*
0002     SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QWindow>
0010 
0011 #include <QGuiApplication>
0012 #include <qpa/qplatformnativeinterface.h>
0013 
0014 struct wl_surface;
0015 
0016 inline wl_surface *surfaceForWindow(QWindow *window)
0017 {
0018     if (!window) {
0019         return nullptr;
0020     }
0021 
0022     QPlatformNativeInterface *native = qGuiApp->platformNativeInterface();
0023     if (!native) {
0024         return nullptr;
0025     }
0026     window->create();
0027     return reinterpret_cast<wl_surface *>(native->nativeResourceForWindow(QByteArrayLiteral("surface"), window));
0028 }