kwin/src/wayland/xdgforeign_v2_interface.h
Alexander Lohnau 525d12bee5 Run clang-format
If you want git blame to ignore formatting revisions run:
git config blame.ignoreRevsFile .git-blame-ignore-revs
2021-08-29 07:11:06 +02:00

60 lines
2.1 KiB
C++

/*
SPDX-FileCopyrightText: 2017 Marco Martin <notmart@gmail.com>
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#pragma once
#include <QObject>
#include <KWaylandServer/kwaylandserver_export.h>
namespace KWaylandServer
{
class Display;
class SurfaceInterface;
class XdgForeignV2InterfacePrivate;
/**
* This class encapsulates the server side logic of the XdgForeign protocol.
* a process can export a surface to be identifiable by a server-wide unique
* string handle, and another process can in turn import that surface, and set it
* as transient parent for one of its own surfaces.
* This parent relationship is traced by the transientChanged signal and the
* transientFor method.
*/
class KWAYLANDSERVER_EXPORT XdgForeignV2Interface : public QObject
{
Q_OBJECT
public:
XdgForeignV2Interface(Display *display, QObject *parent = nullptr);
~XdgForeignV2Interface() override;
/**
* If a client did import a surface and set one of its own as child of the
* imported one, this returns the mapping.
* @param surface the child surface we want to search an imported transientParent for.
* @returns the transient parent of the surface, if found, nullptr otherwise.
*/
SurfaceInterface *transientFor(SurfaceInterface *surface);
Q_SIGNALS:
/**
* A surface got a new imported transient parent
* @param parent is the surface exported by one client and imported into another, which will act as parent.
* @param child is the surface that the importer client did set as child of the surface
* that it imported.
* If one of the two paramenters is nullptr, it means that a previously relation is not
* valid anymore and either one of the surfaces has been unmapped, or the parent surface
* is not exported anymore.
*/
void transientChanged(KWaylandServer::SurfaceInterface *child, KWaylandServer::SurfaceInterface *parent);
private:
friend class XdgExporterV2Interface;
friend class XdgImporterV2Interface;
QScopedPointer<XdgForeignV2InterfacePrivate> d;
};
}