Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwldatadevicemanager_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef WLDATADEVICEMANAGER_H
5#define WLDATADEVICEMANAGER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/QList>
19#include <QtCore/QMap>
20#include <QtGui/QClipboard>
21#include <QtCore/QMimeData>
22
23#include <QtWaylandCompositor/QWaylandCompositor>
24
25#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
26#include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h>
27
28QT_REQUIRE_CONFIG(wayland_datadevice);
29
31
32class QSocketNotifier;
33
34namespace QtWayland {
35
36class DataDevice;
37class DataSource;
38
39class DataDeviceManager : public QObject, public QtWaylandServer::wl_data_device_manager
40{
42
43public:
45
46 void setCurrentSelectionSource(DataSource *source);
47 DataSource *currentSelectionSource();
48
49 struct wl_display *display() const;
50
51 void sourceDestroyed(DataSource *source);
52
54 bool offerFromCompositorToClient(wl_resource *clientDataDeviceResource);
55 void offerRetainedSelection(wl_resource *clientDataDeviceResource);
56
57protected:
58 void data_device_manager_create_data_source(Resource *resource, uint32_t id) override;
59 void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) override;
60
61private Q_SLOTS:
62 void readFromClient(int fd);
63
64private:
65 void retain();
66 void finishReadFromClient(bool exhausted = false);
67
68 QWaylandCompositor *m_compositor = nullptr;
69 QList<DataDevice *> m_data_device_list;
70
71 DataSource *m_current_selection_source = nullptr;
72
73 QMimeData m_retainedData;
74 QSocketNotifier *m_retainedReadNotifier = nullptr;
75 QList<QSocketNotifier *> m_obsoleteRetainedReadNotifiers;
76 int m_retainedReadIndex = 0;
77 QByteArray m_retainedReadBuf;
78
79 bool m_compositorOwnsSelection = false;
80
81
82 static void comp_accept(struct wl_client *client,
83 struct wl_resource *resource,
84 uint32_t time,
85 const char *type);
86 static void comp_receive(struct wl_client *client,
87 struct wl_resource *resource,
88 const char *mime_type,
89 int32_t fd);
90 static void comp_destroy(struct wl_client *client,
91 struct wl_resource *resource);
92
93 static const struct wl_data_offer_interface compositor_offer_interface;
94};
95
96}
97
99
100#endif // WLDATADEVICEMANAGER_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
\qmltype WaylandCompositor \instantiates QWaylandCompositor \inqmlmodule QtWayland....
Combined button and popup list for selecting options.
static QOpenGLCompositor * compositor
GLenum type
GLuint64 GLenum GLint fd
GLsizei GLsizei GLchar * source
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SLOTS
QMimeData * mimeData
bool offerFromCompositorToClient(wl_resource *clientDataDeviceResource)
void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) override
DataDeviceManager(QWaylandCompositor *compositor)
struct wl_display * display() const
void overrideSelection(const QMimeData &mimeData)
void sourceDestroyed(DataSource *source)
void offerRetainedSelection(wl_resource *clientDataDeviceResource)
void setCurrentSelectionSource(DataSource *source)
void data_device_manager_create_data_source(Resource *resource, uint32_t id) override