kwin/src/scene/dndiconitem.cpp
Vlad Zahorodnii 79d5a70c01 wayland: Make SurfaceInterface::{frameRendered,takePresentationFeedback} not touch subsurface tree
This gives us greater flexibility and in general more cleaner code.
2023-11-14 14:58:40 +00:00

49 lines
1.3 KiB
C++

/*
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "scene/dndiconitem.h"
#include "scene/surfaceitem_wayland.h"
#include "wayland/datadevice.h"
#include "wayland/surface.h"
namespace KWin
{
DragAndDropIconItem::DragAndDropIconItem(DragAndDropIcon *icon, Scene *scene, Item *parent)
: Item(scene, parent)
{
m_surfaceItem = std::make_unique<SurfaceItemWayland>(icon->surface(), scene, this);
m_surfaceItem->setPosition(icon->position());
connect(icon, &DragAndDropIcon::destroyed, this, [this]() {
m_surfaceItem.reset();
});
connect(icon, &DragAndDropIcon::changed, this, [this, icon]() {
m_surfaceItem->setPosition(icon->position());
});
}
DragAndDropIconItem::~DragAndDropIconItem()
{
}
SurfaceInterface *DragAndDropIconItem::surface() const
{
return m_surfaceItem ? m_surfaceItem->surface() : nullptr;
}
void DragAndDropIconItem::setOutput(Output *output)
{
if (m_surfaceItem && output) {
m_output = output;
m_surfaceItem->surface()->setPreferredBufferScale(output->scale());
m_surfaceItem->surface()->setPreferredColorDescription(output->colorDescription());
}
}
} // namespace KWin
#include "moc_dndiconitem.cpp"