2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2018-08-21 20:06:42 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
2018-08-21 20:06:42 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2018-08-21 20:06:42 +00:00
|
|
|
#ifndef KWIN_XWL_CLIPBOARD
|
|
|
|
#define KWIN_XWL_CLIPBOARD
|
|
|
|
|
|
|
|
#include "selection.h"
|
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
namespace KWaylandServer
|
2018-08-21 20:06:42 +00:00
|
|
|
{
|
2020-05-26 08:55:54 +00:00
|
|
|
class AbstractDataSource;
|
2018-08-21 20:06:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
namespace Xwl
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the X clipboard, which is on Wayland side just called
|
|
|
|
* @e selection.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-08-21 20:06:42 +00:00
|
|
|
class Clipboard : public Selection
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-07-02 19:56:03 +00:00
|
|
|
|
2018-08-21 20:06:42 +00:00
|
|
|
public:
|
|
|
|
Clipboard(xcb_atom_t atom, QObject *parent);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) override;
|
2019-07-02 19:56:03 +00:00
|
|
|
void x11OffersChanged(const QStringList &added, const QStringList &removed) override;
|
2018-08-21 20:06:42 +00:00
|
|
|
/**
|
|
|
|
* React to Wl selection change.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2020-05-26 08:55:54 +00:00
|
|
|
void wlSelectionChanged(KWaylandServer::AbstractDataSource *dsi);
|
2018-08-21 20:06:42 +00:00
|
|
|
/**
|
|
|
|
* Check the current state of the selection and if a source needs
|
|
|
|
* to be created or destroyed.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-08-21 20:06:42 +00:00
|
|
|
void checkWlSource();
|
|
|
|
|
2020-06-11 22:33:28 +00:00
|
|
|
/**
|
|
|
|
* Returns of dsi is managed by our data bridge
|
|
|
|
*/
|
|
|
|
bool ownsSelection(KWaylandServer::AbstractDataSource *dsi) const;
|
|
|
|
|
2018-08-21 20:06:42 +00:00
|
|
|
QMetaObject::Connection m_checkConnection;
|
2019-07-02 19:56:03 +00:00
|
|
|
|
|
|
|
Q_DISABLE_COPY(Clipboard)
|
2020-10-20 00:29:01 +00:00
|
|
|
bool m_waitingForTargets = false;
|
2018-08-21 20:06:42 +00:00
|
|
|
};
|
|
|
|
|
2019-07-02 19:56:03 +00:00
|
|
|
} // namespace Xwl
|
|
|
|
} // namespace KWin
|
2018-08-21 20:06:42 +00:00
|
|
|
|
|
|
|
#endif
|