summaryrefslogtreecommitdiffstats
path: root/examples/wayland/custom-shell/compositor/exampleshellintegration.cpp
blob: 840927d0f2f2c7296ad93abbd531f0151afd11ce (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include "exampleshellintegration.h"

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


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

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

void ExampleShellIntegration::handleExampleShellSurfaceDestroyed()
{
    m_shellSurface = nullptr;
}