Changeset View
Changeset View
Standalone View
Standalone View
src/util/kmodifierkeyinfoprovider_xcb.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright 2009 Michael Leupold <lemma@confuego.org> | ||||
3 | Copyright 2013 Martin Gräßlin <mgraesslin@kde.org> | ||||
4 | | ||||
5 | This library is free software; you can redistribute it and/or | ||||
6 | modify it under the terms of the GNU Lesser General Public | ||||
7 | License as published by the Free Software Foundation; either | ||||
8 | version 2.1 of the License, or (at your option) version 3, or any | ||||
9 | later version accepted by the membership of KDE e.V. (or its | ||||
10 | successor approved by the membership of KDE e.V.), which shall | ||||
11 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
12 | | ||||
13 | This library is distributed in the hope that it will be useful, | ||||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
16 | Lesser General Public License for more details. | ||||
17 | | ||||
18 | You should have received a copy of the GNU Lesser General Public | ||||
19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
20 | */ | ||||
21 | | ||||
22 | #ifndef KMODIFIERKEYINFOPROVIDERXCB_H | ||||
23 | #define KMODIFIERKEYINFOPROVIDERXCB_H | ||||
24 | | ||||
25 | #include "kmodifierkeyinfoprovider_p.h" | ||||
26 | | ||||
27 | class KModifierKeyInfoProviderXcb : public KModifierKeyInfoProvider, public QAbstractNativeEventFilter | ||||
28 | { | ||||
29 | Q_OBJECT | ||||
30 | public: | ||||
31 | KModifierKeyInfoProviderXcb(); | ||||
32 | ~KModifierKeyInfoProviderXcb(); | ||||
33 | | ||||
34 | bool setKeyLatched(Qt::Key key, bool latched) override; | ||||
35 | bool setKeyLocked(Qt::Key key, bool locked) override; | ||||
36 | | ||||
37 | bool nativeEventFilter(const QByteArray &eventType, void *message, long int *result) override; | ||||
38 | | ||||
39 | void xkbUpdateModifierMapping(); | ||||
40 | void xkbModifierStateChanged(unsigned char mods, unsigned char latched_mods, | ||||
41 | unsigned char locked_mods); | ||||
42 | void xkbButtonStateChanged(unsigned short ptr_buttons); | ||||
43 | | ||||
44 | private: | ||||
45 | int m_xkbEv; | ||||
46 | bool m_xkbAvailable; | ||||
47 | | ||||
48 | // maps a Qt::Key to a modifier mask | ||||
49 | QHash<Qt::Key, unsigned int> m_xkbModifiers; | ||||
50 | // maps a Qt::MouseButton to a button mask | ||||
51 | QHash<Qt::MouseButton, unsigned short> m_xkbButtons; | ||||
52 | }; | ||||
53 | | ||||
54 | #endif |