Changeset View
Changeset View
Standalone View
Standalone View
src/client/keystate.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2019 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU Lesser General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | later version accepted by the membership of KDE e.V. (or its | ||||
9 | successor approved by the membership of KDE e.V.), which shall | ||||
10 | act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Lesser General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Lesser General Public | ||||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | #ifndef WAYLAND_KEYSTATE_H | ||||
21 | #define WAYLAND_KEYSTATE_H | ||||
22 | | ||||
23 | #include <QObject> | ||||
24 | | ||||
25 | #include <KWayland/Client/kwaylandclient_export.h> | ||||
26 | | ||||
27 | struct org_kde_kwin_keystate; | ||||
28 | | ||||
29 | namespace KWayland | ||||
30 | { | ||||
31 | namespace Client | ||||
32 | { | ||||
33 | class EventQueue; | ||||
34 | | ||||
35 | class KWAYLANDCLIENT_EXPORT Keystate : public QObject | ||||
36 | { | ||||
37 | Q_OBJECT | ||||
38 | public: | ||||
39 | enum class Key { | ||||
40 | CapsLock = 0, | ||||
41 | NumLock = 1, | ||||
42 | ScrollLock = 2, | ||||
43 | }; | ||||
44 | Q_ENUM(Key); | ||||
45 | enum State { | ||||
46 | Unlocked = 0, | ||||
47 | Latched = 1, | ||||
48 | Locked = 2, | ||||
49 | }; | ||||
50 | Q_ENUM(State) | ||||
51 | | ||||
52 | Keystate(QObject* parent); | ||||
53 | ~Keystate() override; | ||||
54 | | ||||
55 | void setEventQueue(EventQueue *queue); | ||||
56 | | ||||
57 | void destroy(); | ||||
58 | void setup(org_kde_kwin_keystate* keystate); | ||||
59 | | ||||
60 | void fetchStates(); | ||||
61 | | ||||
62 | Q_SIGNALS: | ||||
63 | /** | ||||
64 | * State of the @p key changed to @p state | ||||
65 | */ | ||||
66 | void stateChanged(Key key, State state); | ||||
67 | | ||||
68 | /** | ||||
69 | * The corresponding global for this interface on the Registry got removed. | ||||
70 | **/ | ||||
71 | void removed(); | ||||
72 | | ||||
73 | private: | ||||
74 | class Private; | ||||
75 | QScopedPointer<Private> d; | ||||
76 | }; | ||||
77 | | ||||
78 | } | ||||
79 | } | ||||
80 | | ||||
81 | #endif |