1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QEVDEVKEYBOARDHANDLER_P_H
#define QEVDEVKEYBOARDHANDLER_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <qobject.h>
#include <qloggingcategory.h>
#include <QtInputSupport/private/qfdcontainer_p.h>
#include <QtInputSupport/private/qkeyboardmap_p.h>
#include <QtInputSupport/private/qkeycodeaction_p.h>
#include <private/qglobal_p.h>
#include <memory>
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcEvdevKey)
class QSocketNotifier;
class QEvdevKeyboardHandler : public QObject
{
public:
QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile);
~QEvdevKeyboardHandler();
static std::unique_ptr<QEvdevKeyboardHandler> create(const QString &device,
const QString &specification,
const QString &defaultKeymapFile = QString());
bool loadKeymap(const QString &file);
void unloadKeymap();
void readKeycode();
QKeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat);
void switchLang();
private:
void processKeyEvent(int nativecode, int unicode, int qtcode,
Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat);
void switchLed(int, bool);
QString m_device;
QFdContainer m_fd;
QSocketNotifier *m_notify;
// keymap handling
quint8 m_modifiers;
quint8 m_locks[3];
int m_composing;
quint16 m_dead_unicode;
quint8 m_langLock;
bool m_no_zap;
bool m_do_compose;
const QKeyboardMap::Mapping *m_keymap;
int m_keymap_size;
const QKeyboardMap::Composing *m_keycompose;
int m_keycompose_size;
static const QKeyboardMap::Mapping s_keymap_default[];
static const QKeyboardMap::Composing s_keycompose_default[];
};
QT_END_NAMESPACE
#endif // QEVDEVKEYBOARDHANDLER_P_H
|