2021-08-17 10:25:34 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
SPDX-FileCopyrightText: 2021 David Redondo <kde@david-redondo.de>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
#ifndef KWIN_XWL_PRIMARY
|
|
|
|
#define KWIN_XWL_PRIMARY
|
|
|
|
|
|
|
|
#include "selection.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace KWaylandServer
|
|
|
|
{
|
|
|
|
class AbstractDataSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
namespace Xwl
|
|
|
|
{
|
2021-08-19 09:34:29 +00:00
|
|
|
class XwlDataSource;
|
2021-08-17 10:25:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the X clipboard, which is on Wayland side just called
|
|
|
|
* @e selection.
|
|
|
|
*/
|
|
|
|
class Primary : public Selection
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Primary(xcb_atom_t atom, QObject *parent);
|
|
|
|
~Primary() override;
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2021-08-17 10:25:34 +00:00
|
|
|
private:
|
|
|
|
void doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) override;
|
|
|
|
void x11OffersChanged(const QStringList &added, const QStringList &removed) override;
|
|
|
|
/**
|
|
|
|
* React to Wl selection change.
|
|
|
|
*/
|
|
|
|
void wlPrimarySelectionChanged(KWaylandServer::AbstractDataSource *dsi);
|
|
|
|
/**
|
|
|
|
* Check the current state of the selection and if a source needs
|
|
|
|
* to be created or destroyed.
|
|
|
|
*/
|
|
|
|
void checkWlSource();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if dsi is managed by our data bridge
|
|
|
|
*/
|
|
|
|
bool ownsSelection(KWaylandServer::AbstractDataSource *dsi) const;
|
|
|
|
|
|
|
|
QMetaObject::Connection m_checkConnection;
|
|
|
|
|
|
|
|
Q_DISABLE_COPY(Primary)
|
|
|
|
bool m_waitingForTargets = false;
|
2021-08-19 09:34:29 +00:00
|
|
|
std::unique_ptr<XwlDataSource> m_primarySelectionSource;
|
2021-08-17 10:25:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Xwl
|
|
|
|
} // namespace KWin
|
|
|
|
|
|
|
|
#endif
|