File indexing completed on 2024-05-19 05:32:49

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include "effect/globals.h"
0012 
0013 #include <QAbstractNativeEventFilter>
0014 #include <QObject>
0015 #include <QPoint>
0016 
0017 namespace KWin
0018 {
0019 class DataDeviceInterface;
0020 class SurfaceInterface;
0021 class Window;
0022 
0023 namespace Xwl
0024 {
0025 class Clipboard;
0026 class Dnd;
0027 class Primary;
0028 enum class DragEventReply;
0029 
0030 /**
0031  * Interface class for all data sharing in the context of X selections
0032  * and Wayland's internal mechanism.
0033  *
0034  * Exists only once per Xwayland session.
0035  */
0036 class DataBridge : public QObject, public QAbstractNativeEventFilter
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041     explicit DataBridge();
0042 
0043     DragEventReply dragMoveFilter(Window *target);
0044 
0045     Dnd *dnd() const
0046     {
0047         return m_dnd;
0048     }
0049 
0050     bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
0051 
0052 private:
0053     void init();
0054 
0055     Clipboard *m_clipboard = nullptr;
0056     Dnd *m_dnd = nullptr;
0057     Primary *m_primary = nullptr;
0058 };
0059 
0060 } // namespace Xwl
0061 } // namespace KWin