2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2022-12-16 20:08:44 +00:00
|
|
|
#pragma once
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2022-08-01 21:29:02 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2018-08-22 12:36:11 +00:00
|
|
|
#include "xwayland_interface.h"
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2022-08-03 10:07:09 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2021-02-08 22:00:08 +00:00
|
|
|
class KSelectionOwner;
|
2022-03-12 14:09:57 +00:00
|
|
|
class QSocketNotifier;
|
2021-02-08 22:00:08 +00:00
|
|
|
|
2019-02-19 08:50:20 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
2022-04-14 12:33:28 +00:00
|
|
|
class Output;
|
2022-07-15 07:15:54 +00:00
|
|
|
class Application;
|
2019-02-19 08:50:20 +00:00
|
|
|
|
|
|
|
namespace Xwl
|
|
|
|
{
|
2022-01-25 14:17:51 +00:00
|
|
|
class XrandrEventFilter;
|
2022-01-27 19:14:53 +00:00
|
|
|
class XwaylandInputSpy;
|
2022-03-12 14:09:57 +00:00
|
|
|
class XwaylandLauncher;
|
2022-08-03 10:07:09 +00:00
|
|
|
class DataBridge;
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2022-08-03 10:31:27 +00:00
|
|
|
class KWIN_EXPORT Xwayland : public QObject, public XwaylandInterface
|
2019-02-19 08:50:20 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-07-02 19:56:03 +00:00
|
|
|
|
2019-02-19 08:50:20 +00:00
|
|
|
public:
|
2022-07-05 11:43:25 +00:00
|
|
|
Xwayland(Application *app);
|
2019-07-02 19:56:03 +00:00
|
|
|
~Xwayland() override;
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2023-01-27 12:29:32 +00:00
|
|
|
void init();
|
2022-03-12 14:09:57 +00:00
|
|
|
|
|
|
|
XwaylandLauncher *xwaylandLauncher() const;
|
2020-07-20 08:07:08 +00:00
|
|
|
|
2019-02-19 08:50:20 +00:00
|
|
|
Q_SIGNALS:
|
2020-07-20 08:07:08 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the Xwayland server has been started successfully and it is
|
|
|
|
* ready to accept and manage X11 clients.
|
|
|
|
*/
|
|
|
|
void started();
|
2022-03-12 14:09:57 +00:00
|
|
|
|
2020-09-08 08:18:31 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when an error occurs with the Xwayland server.
|
|
|
|
*/
|
|
|
|
void errorOccurred();
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2020-07-20 08:07:08 +00:00
|
|
|
private Q_SLOTS:
|
2022-03-12 14:09:57 +00:00
|
|
|
void handleXwaylandFinished();
|
2020-09-08 09:35:47 +00:00
|
|
|
void handleXwaylandReady();
|
2020-07-20 08:07:08 +00:00
|
|
|
|
2021-02-09 08:17:48 +00:00
|
|
|
void handleSelectionLostOwnership();
|
|
|
|
void handleSelectionFailedToClaimOwnership();
|
|
|
|
void handleSelectionClaimedOwnership();
|
|
|
|
|
2019-02-19 08:50:20 +00:00
|
|
|
private:
|
2022-01-25 14:17:51 +00:00
|
|
|
friend class XrandrEventFilter;
|
|
|
|
|
2023-02-08 10:34:20 +00:00
|
|
|
enum class DispatchEventsMode {
|
|
|
|
Poll,
|
|
|
|
EventQueue
|
|
|
|
};
|
|
|
|
void dispatchEvents(DispatchEventsMode mode);
|
|
|
|
|
2020-07-20 08:07:08 +00:00
|
|
|
void installSocketNotifier();
|
|
|
|
void uninstallSocketNotifier();
|
2022-07-30 12:13:35 +00:00
|
|
|
void updatePrimary();
|
2022-01-27 19:14:53 +00:00
|
|
|
void refreshEavesdropping();
|
2020-07-20 08:07:08 +00:00
|
|
|
|
2020-09-01 16:01:19 +00:00
|
|
|
bool createX11Connection();
|
2020-07-07 10:05:39 +00:00
|
|
|
void destroyX11Connection();
|
2019-02-19 08:50:20 +00:00
|
|
|
|
2023-05-05 19:20:00 +00:00
|
|
|
DragEventReply dragMoveFilter(Window *target) override;
|
2021-09-03 11:47:57 +00:00
|
|
|
KWaylandServer::AbstractDropHandler *xwlDropHandler() override;
|
2020-07-20 08:07:08 +00:00
|
|
|
QSocketNotifier *m_socketNotifier = nullptr;
|
2022-03-12 14:09:57 +00:00
|
|
|
|
2022-07-15 07:15:54 +00:00
|
|
|
Application *m_app;
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KSelectionOwner> m_selectionOwner;
|
2022-08-03 10:07:09 +00:00
|
|
|
std::unique_ptr<DataBridge> m_dataBridge;
|
2021-07-28 10:03:10 +00:00
|
|
|
|
2022-01-25 14:17:51 +00:00
|
|
|
XrandrEventFilter *m_xrandrEventsFilter = nullptr;
|
2022-03-12 14:09:57 +00:00
|
|
|
XwaylandLauncher *m_launcher;
|
2022-01-27 19:14:53 +00:00
|
|
|
std::unique_ptr<XwaylandInputSpy> m_inputSpy;
|
2019-07-02 19:56:03 +00:00
|
|
|
|
|
|
|
Q_DISABLE_COPY(Xwayland)
|
2019-02-19 08:50:20 +00:00
|
|
|
};
|
|
|
|
|
2019-07-02 19:56:03 +00:00
|
|
|
} // namespace Xwl
|
|
|
|
} // namespace KWin
|