1// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWAYLANDCLIENT_H
5#define QWAYLANDCLIENT_H
6
7#include <QtWaylandCompositor/qtwaylandcompositorglobal.h>
8#include <QtWaylandCompositor/qtwaylandqmlinclude.h>
9
10#include <QtCore/QObject>
11
12#include <signal.h>
13
14struct wl_client;
15
16QT_BEGIN_NAMESPACE
17
18class QWaylandClientPrivate;
19class QWaylandCompositor;
20
21class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandClient : public QObject
22{
23 Q_OBJECT
24 Q_DECLARE_PRIVATE(QWaylandClient)
25
26 Q_PROPERTY(QWaylandCompositor *compositor READ compositor CONSTANT)
27 Q_PROPERTY(qint64 userId READ userId CONSTANT)
28 Q_PROPERTY(qint64 groupId READ groupId CONSTANT)
29 Q_PROPERTY(qint64 processId READ processId CONSTANT)
30 Q_MOC_INCLUDE("qwaylandcompositor.h")
31
32 QML_NAMED_ELEMENT(WaylandClient)
33 QML_ADDED_IN_VERSION(1, 0)
34 QML_UNCREATABLE("")
35public:
36 ~QWaylandClient() override;
37
38 enum TextInputProtocol {
39 NoProtocol = 0,
40 QtTextInputMethodV1 = 1,
41 TextInputV2 = 2,
42 TextInputV4 = 4,
43
44 QtTextInputMethod = QtTextInputMethodV1,
45 TextInput = TextInputV2
46 };
47 Q_DECLARE_FLAGS(TextInputProtocols, TextInputProtocol)
48
49 TextInputProtocols textInputProtocols() const;
50 void setTextInputProtocols(TextInputProtocols p);
51
52 static QWaylandClient *fromWlClient(QWaylandCompositor *compositor, wl_client *wlClient);
53
54 QWaylandCompositor *compositor() const;
55
56 wl_client *client() const;
57
58 qint64 userId() const;
59 qint64 groupId() const;
60
61 qint64 processId() const;
62
63 Q_INVOKABLE void kill(int signal = SIGTERM);
64
65public Q_SLOTS:
66 void close();
67
68private:
69 explicit QWaylandClient(QWaylandCompositor *compositor, wl_client *client);
70};
71
72QT_END_NAMESPACE
73
74#endif // QWAYLANDCLIENT_H
75

source code of qtwayland/src/compositor/compositor_api/qwaylandclient.h