2022-05-07 11:17:36 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
2022-12-15 20:35:22 +00:00
|
|
|
#include "scene/dndiconitem.h"
|
|
|
|
#include "scene/surfaceitem_wayland.h"
|
2022-05-07 11:17:36 +00:00
|
|
|
#include "wayland/datadevice_interface.h"
|
|
|
|
#include "wayland/surface_interface.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2022-12-18 22:20:28 +00:00
|
|
|
DragAndDropIconItem::DragAndDropIconItem(KWaylandServer::DragAndDropIcon *icon, Scene *scene, Item *parent)
|
2022-12-18 12:30:40 +00:00
|
|
|
: Item(scene, parent)
|
2022-05-07 11:17:36 +00:00
|
|
|
{
|
2022-12-18 12:30:40 +00:00
|
|
|
m_surfaceItem = std::make_unique<SurfaceItemWayland>(icon->surface(), scene, this);
|
2022-05-07 11:17:36 +00:00
|
|
|
m_surfaceItem->setPosition(icon->position());
|
|
|
|
|
|
|
|
connect(icon, &KWaylandServer::DragAndDropIcon::destroyed, this, [this]() {
|
|
|
|
m_surfaceItem.reset();
|
|
|
|
});
|
|
|
|
connect(icon, &KWaylandServer::DragAndDropIcon::changed, this, [this, icon]() {
|
|
|
|
m_surfaceItem->setPosition(icon->position());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
DragAndDropIconItem::~DragAndDropIconItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void DragAndDropIconItem::frameRendered(quint32 timestamp)
|
|
|
|
{
|
|
|
|
if (m_surfaceItem) {
|
|
|
|
m_surfaceItem->surface()->frameRendered(timestamp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace KWin
|