1 | // Copyright (C) 2017 The Qt Company Ltd. |
2 | // Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB). |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
4 | |
5 | #ifndef QWAYLANDKEYBOARD_H |
6 | #define QWAYLANDKEYBOARD_H |
7 | |
8 | #include <QtCore/QObject> |
9 | |
10 | #include <QtWaylandCompositor/QWaylandCompositorExtension> |
11 | #include <QtWaylandCompositor/QWaylandSurface> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QWaylandKeyboard; |
16 | class QWaylandKeyboardPrivate; |
17 | class QWaylandSeat; |
18 | class QWaylandKeymap; |
19 | |
20 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject |
21 | { |
22 | Q_OBJECT |
23 | Q_DECLARE_PRIVATE(QWaylandKeyboard) |
24 | Q_PROPERTY(quint32 repeatRate READ repeatRate WRITE setRepeatRate NOTIFY repeatRateChanged) |
25 | Q_PROPERTY(quint32 repeatDelay READ repeatDelay WRITE setRepeatDelay NOTIFY repeatDelayChanged) |
26 | public: |
27 | QWaylandKeyboard(QWaylandSeat *seat, QObject *parent = nullptr); |
28 | |
29 | QWaylandSeat *seat() const; |
30 | QWaylandCompositor *compositor() const; |
31 | |
32 | quint32 repeatRate() const; |
33 | void setRepeatRate(quint32 rate); |
34 | |
35 | quint32 repeatDelay() const; |
36 | void setRepeatDelay(quint32 delay); |
37 | |
38 | virtual void setFocus(QWaylandSurface *surface); |
39 | |
40 | virtual void sendKeyModifiers(QWaylandClient *client, uint32_t serial); |
41 | virtual void sendKeyPressEvent(uint code); |
42 | virtual void sendKeyReleaseEvent(uint code); |
43 | |
44 | QWaylandSurface *focus() const; |
45 | QWaylandClient *focusClient() const; |
46 | |
47 | virtual void addClient(QWaylandClient *client, uint32_t id, uint32_t version); |
48 | |
49 | uint keyToScanCode(int qtKey) const; |
50 | |
51 | Q_SIGNALS: |
52 | void focusChanged(QWaylandSurface *surface); |
53 | void repeatRateChanged(quint32 repeatRate); |
54 | void repeatDelayChanged(quint32 repeatDelay); |
55 | |
56 | private: |
57 | void focusDestroyed(void *data); |
58 | |
59 | private Q_SLOTS: |
60 | void updateKeymap(); |
61 | }; |
62 | |
63 | QT_END_NAMESPACE |
64 | |
65 | #endif //QWAYLANDKEYBOARD_H |
66 | |