1/****************************************************************************
2**
3** Copyright (C) 2017 The Qt Company Ltd.
4** Copyright (C) 2017 Klarälvdalens Datakonsult AB (KDAB).
5** Contact: https://www.qt.io/licensing/
6**
7** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:GPL$
10** Commercial License Usage
11** Licensees holding valid commercial Qt licenses may use this file in
12** accordance with the commercial license agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and The Qt Company. For licensing terms
15** and conditions see https://www.qt.io/terms-conditions. For further
16** information use the contact form at https://www.qt.io/contact-us.
17**
18** GNU General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU
20** General Public License version 3 or (at your option) any later version
21** approved by the KDE Free Qt Foundation. The licenses are as published by
22** the Free Software Foundation and appearing in the file LICENSE.GPL3
23** included in the packaging of this file. Please review the following
24** information to ensure the GNU General Public License requirements will
25** be met: https://www.gnu.org/licenses/gpl-3.0.html.
26**
27** $QT_END_LICENSE$
28**
29****************************************************************************/
30
31#ifndef QWAYLANDKEYBOARD_H
32#define QWAYLANDKEYBOARD_H
33
34#include <QtCore/QObject>
35
36#include <QtWaylandCompositor/QWaylandCompositorExtension>
37#include <QtWaylandCompositor/QWaylandSurface>
38
39QT_BEGIN_NAMESPACE
40
41class QWaylandKeyboard;
42class QWaylandKeyboardPrivate;
43class QWaylandSeat;
44class QWaylandKeymap;
45
46class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject
47{
48 Q_OBJECT
49 Q_DECLARE_PRIVATE(QWaylandKeyboard)
50 Q_PROPERTY(quint32 repeatRate READ repeatRate WRITE setRepeatRate NOTIFY repeatRateChanged)
51 Q_PROPERTY(quint32 repeatDelay READ repeatDelay WRITE setRepeatDelay NOTIFY repeatDelayChanged)
52public:
53 QWaylandKeyboard(QWaylandSeat *seat, QObject *parent = nullptr);
54
55 QWaylandSeat *seat() const;
56 QWaylandCompositor *compositor() const;
57
58 quint32 repeatRate() const;
59 void setRepeatRate(quint32 rate);
60
61 quint32 repeatDelay() const;
62 void setRepeatDelay(quint32 delay);
63
64 virtual void setFocus(QWaylandSurface *surface);
65
66 virtual void sendKeyModifiers(QWaylandClient *client, uint32_t serial);
67 virtual void sendKeyPressEvent(uint code);
68 virtual void sendKeyReleaseEvent(uint code);
69
70 QWaylandSurface *focus() const;
71 QWaylandClient *focusClient() const;
72
73 virtual void addClient(QWaylandClient *client, uint32_t id, uint32_t version);
74
75 uint keyToScanCode(int qtKey) const;
76
77Q_SIGNALS:
78 void focusChanged(QWaylandSurface *surface);
79 void repeatRateChanged(quint32 repeatRate);
80 void repeatDelayChanged(quint32 repeatDelay);
81
82private:
83 void focusDestroyed(void *data);
84
85private Q_SLOTS:
86 void updateKeymap();
87};
88
89QT_END_NAMESPACE
90
91#endif //QWAYLANDKEYBOARD_H
92

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