| 1 | // Copyright (C) 2021 The Qt Company Ltd. | 
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
| 3 | |
| 4 | #include "qwaylandqtshellintegration_p.h" | 
| 5 | |
| 6 | #include <QtWaylandCompositor/QWaylandCompositor> | 
| 7 | #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> | 
| 8 | #include <QtWaylandCompositor/QWaylandSeat> | 
| 9 | #include "qwaylandqtshell.h" | 
| 10 | |
| 11 | QT_BEGIN_NAMESPACE | 
| 12 | |
| 13 | namespace QtWayland { | 
| 14 | |
| 15 | QtShellIntegration::QtShellIntegration(QWaylandQuickShellSurfaceItem *item) | 
| 16 | : QWaylandQuickShellIntegration(item) | 
| 17 | , m_item(item) | 
| 18 | , m_shellSurface(qobject_cast<QWaylandQtShellSurface *>(object: item->shellSurface())) | 
| 19 | { | 
| 20 | m_item->setSurface(m_shellSurface->surface()); | 
| 21 | connect(sender: m_shellSurface, signal: &QWaylandQtShellSurface::destroyed, | 
| 22 | context: this, slot: &QtShellIntegration::handleQtShellSurfaceDestroyed); | 
| 23 | } | 
| 24 | |
| 25 | QtShellIntegration::~QtShellIntegration() | 
| 26 | { | 
| 27 | m_item->setSurface(nullptr); | 
| 28 | } | 
| 29 | |
| 30 | void QtShellIntegration::handleQtShellSurfaceDestroyed() | 
| 31 | { | 
| 32 | m_shellSurface = nullptr; | 
| 33 | } | 
| 34 | |
| 35 | } | 
| 36 | |
| 37 | QT_END_NAMESPACE | 
| 38 | |
| 39 | #include "moc_qwaylandqtshellintegration_p.cpp" | 
| 40 | 
