summaryrefslogtreecommitdiffstats
path: root/src/imports/compositor-extensions/qtshell/qwaylandqtshellintegration.cpp
blob: 07a9363221867f97049e0398bc216d57d3105ee4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "qwaylandqtshellintegration_p.h"

#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem>
#include <QtWaylandCompositor/QWaylandSeat>
#include "qwaylandqtshell.h"

QT_BEGIN_NAMESPACE

namespace QtWayland {

QtShellIntegration::QtShellIntegration(QWaylandQuickShellSurfaceItem *item)
    : QWaylandQuickShellIntegration(item)
    , m_item(item)
    , m_shellSurface(qobject_cast<QWaylandQtShellSurface *>(item->shellSurface()))
{
    m_item->setSurface(m_shellSurface->surface());
    connect(m_shellSurface, &QWaylandQtShellSurface::destroyed,
            this, &QtShellIntegration::handleQtShellSurfaceDestroyed);
}

QtShellIntegration::~QtShellIntegration()
{
    m_item->setSurface(nullptr);
}

void QtShellIntegration::handleQtShellSurfaceDestroyed()
{
    m_shellSurface = nullptr;
}

}

QT_END_NAMESPACE

#include "moc_qwaylandqtshellintegration_p.cpp"