kwin/xwl/clipboard.h
Aleix Pol d335070b80 xwl: Do not refresh the x11 Clipboard while fetching
At the moment there was a race condition when putting something into the
keyboard from XWayland apps. The clipboard manager would announce a new
thing before we'd submitted it all resulting in a broken state.

This change detects when it's fetching and will only refresh the source
after everything has been sent.

BUG: 424754
CCBUG: 412350
2020-10-29 15:56:13 +01:00

62 lines
1.3 KiB
C++

/*
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KWIN_XWL_CLIPBOARD
#define KWIN_XWL_CLIPBOARD
#include "selection.h"
namespace KWaylandServer
{
class AbstractDataSource;
}
namespace KWin
{
namespace Xwl
{
/**
* Represents the X clipboard, which is on Wayland side just called
* @e selection.
*/
class Clipboard : public Selection
{
Q_OBJECT
public:
Clipboard(xcb_atom_t atom, QObject *parent);
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 wlSelectionChanged(KWaylandServer::AbstractDataSource *dsi);
/**
* Check the current state of the selection and if a source needs
* to be created or destroyed.
*/
void checkWlSource();
/**
* Returns of dsi is managed by our data bridge
*/
bool ownsSelection(KWaylandServer::AbstractDataSource *dsi) const;
QMetaObject::Connection m_checkConnection;
Q_DISABLE_COPY(Clipboard)
bool m_waitingForTargets = false;
};
} // namespace Xwl
} // namespace KWin
#endif