swift
Loading...
Searching...
No Matches
keyboardlinux.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_INPUT_KEYBOARD_LINUX_H
7#define SWIFT_INPUT_KEYBOARD_LINUX_H
8
9#include <QDir>
10#include <QFileSystemWatcher>
11#include <QHash>
12
13#include "input/keyboard.h"
15
16// Explicitly including X11 last
17#include <X11/X.h>
18#include <X11/Xlib.h>
19
20namespace swift::input
21{
23 class CKeyboardLinux : public IKeyboard
24 {
26
27 public:
29 CKeyboardLinux(CKeyboardLinux const &) = delete;
30
33
35 ~CKeyboardLinux() override;
36
37 protected:
39 bool init() override;
40
41 private slots:
43 void deviceDirectoryChanged(const QString &);
44
46 void inputReadyRead(int);
47
48 private:
49 friend class IKeyboard;
50
52 CKeyboardLinux(QObject *parent = nullptr);
53
54 void addRawInputDevice(const QString &filePath);
55 void keyEvent(int keyCode, bool isPressed);
56 swift::misc::input::KeyCode convertToKey(int keyCode);
57 bool isModifier(int keyCode);
58 bool isMouseButton(int keyCode);
59
61
62 QFileSystemWatcher *m_devInputWatcher;
63 QHash<QString, QSharedPointer<QFile>> m_keyboardDevices;
64
65 Display *m_display;
66 };
67} // namespace swift::input
68
69#endif // SWIFT_INPUT_KEYBOARD_LINUX_H
bool init()
Initializes the platform keyboard device.
CKeyboardLinux & operator=(CKeyboardLinux const &)=delete
Assignment operator.
CKeyboardLinux(CKeyboardLinux const &)=delete
Copy Constructor.
Value object representing hotkey sequence.
KeyCode
Key code http://www.kbdlayout.info/.
Definition keycodes.h:16
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const