| 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 |  | 
| 14 | struct wl_client; | 
| 15 |  | 
| 16 | QT_BEGIN_NAMESPACE | 
| 17 |  | 
| 18 | class QWaylandClientPrivate; | 
| 19 | class QWaylandCompositor; | 
| 20 |  | 
| 21 | class 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("" ) | 
| 35 | public: | 
| 36 |     ~QWaylandClient() override; | 
| 37 |  | 
| 38 |     enum TextInputProtocol { | 
| 39 |         NoProtocol = 0, | 
| 40 |         QtTextInputMethodV1 = 1, | 
| 41 |         TextInputV2 = 2, | 
| 42 |         TextInputV3 = 4, | 
| 43 |  | 
| 44 |         TextInputV4 = TextInputV3, // TextInputV4 was an experimental API that is now deprecated | 
| 45 |  | 
| 46 |         QtTextInputMethod = QtTextInputMethodV1, | 
| 47 |         TextInput = TextInputV2 | 
| 48 |     }; | 
| 49 |     Q_DECLARE_FLAGS(TextInputProtocols, TextInputProtocol) | 
| 50 |  | 
| 51 |     TextInputProtocols textInputProtocols() const; | 
| 52 |     void setTextInputProtocols(TextInputProtocols p); | 
| 53 |  | 
| 54 |     static QWaylandClient *fromWlClient(QWaylandCompositor *compositor, wl_client *wlClient); | 
| 55 |  | 
| 56 |     QWaylandCompositor *compositor() const; | 
| 57 |  | 
| 58 |     wl_client *client() const; | 
| 59 |  | 
| 60 |     qint64 userId() const; | 
| 61 |     qint64 groupId() const; | 
| 62 |  | 
| 63 |     qint64 processId() const; | 
| 64 |  | 
| 65 |     Q_INVOKABLE void kill(int signal = SIGTERM); | 
| 66 |  | 
| 67 | public Q_SLOTS: | 
| 68 |     void close(); | 
| 69 |  | 
| 70 | private: | 
| 71 |     explicit QWaylandClient(QWaylandCompositor *compositor, wl_client *client); | 
| 72 | }; | 
| 73 |  | 
| 74 | QT_END_NAMESPACE | 
| 75 |  | 
| 76 | #endif // QWAYLANDCLIENT_H | 
| 77 |  |