Changeset View
Changeset View
Standalone View
Standalone View
xkb.h
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
53 | { | 53 | { | ||
54 | Q_OBJECT | 54 | Q_OBJECT | ||
55 | public: | 55 | public: | ||
56 | Xkb(QObject *parent = nullptr); | 56 | Xkb(QObject *parent = nullptr); | ||
57 | ~Xkb(); | 57 | ~Xkb(); | ||
58 | void setConfig(KSharedConfigPtr config) { | 58 | void setConfig(KSharedConfigPtr config) { | ||
59 | m_config = config; | 59 | m_config = config; | ||
60 | } | 60 | } | ||
61 | void setNumLockConfig(KSharedConfigPtr config) { | ||||
62 | m_numLockConfig = config; | ||||
63 | } | ||||
61 | void reconfigure(); | 64 | void reconfigure(); | ||
62 | 65 | | |||
63 | void installKeymap(int fd, uint32_t size); | 66 | void installKeymap(int fd, uint32_t size); | ||
64 | void updateModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); | 67 | void updateModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); | ||
65 | void updateKey(uint32_t key, InputRedirection::KeyboardKeyState state); | 68 | void updateKey(uint32_t key, InputRedirection::KeyboardKeyState state); | ||
66 | xkb_keysym_t toKeysym(uint32_t key); | 69 | xkb_keysym_t toKeysym(uint32_t key); | ||
67 | xkb_keysym_t currentKeysym() const { | 70 | xkb_keysym_t currentKeysym() const { | ||
68 | return m_keysym; | 71 | return m_keysym; | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 120 | private: | |||
125 | xkb_context *m_context; | 128 | xkb_context *m_context; | ||
126 | xkb_keymap *m_keymap; | 129 | xkb_keymap *m_keymap; | ||
127 | xkb_state *m_state; | 130 | xkb_state *m_state; | ||
128 | xkb_mod_index_t m_shiftModifier; | 131 | xkb_mod_index_t m_shiftModifier; | ||
129 | xkb_mod_index_t m_capsModifier; | 132 | xkb_mod_index_t m_capsModifier; | ||
130 | xkb_mod_index_t m_controlModifier; | 133 | xkb_mod_index_t m_controlModifier; | ||
131 | xkb_mod_index_t m_altModifier; | 134 | xkb_mod_index_t m_altModifier; | ||
132 | xkb_mod_index_t m_metaModifier; | 135 | xkb_mod_index_t m_metaModifier; | ||
136 | xkb_mod_index_t m_numModifier; | ||||
133 | xkb_led_index_t m_numLock; | 137 | xkb_led_index_t m_numLock; | ||
134 | xkb_led_index_t m_capsLock; | 138 | xkb_led_index_t m_capsLock; | ||
135 | xkb_led_index_t m_scrollLock; | 139 | xkb_led_index_t m_scrollLock; | ||
136 | Qt::KeyboardModifiers m_modifiers; | 140 | Qt::KeyboardModifiers m_modifiers; | ||
137 | Qt::KeyboardModifiers m_consumedModifiers; | 141 | Qt::KeyboardModifiers m_consumedModifiers; | ||
138 | xkb_keysym_t m_keysym; | 142 | xkb_keysym_t m_keysym; | ||
139 | quint32 m_currentLayout = 0; | 143 | quint32 m_currentLayout = 0; | ||
140 | 144 | | |||
141 | struct { | 145 | struct { | ||
142 | xkb_compose_table *table = nullptr; | 146 | xkb_compose_table *table = nullptr; | ||
143 | xkb_compose_state *state = nullptr; | 147 | xkb_compose_state *state = nullptr; | ||
144 | } m_compose; | 148 | } m_compose; | ||
145 | LEDs m_leds; | 149 | LEDs m_leds; | ||
146 | KSharedConfigPtr m_config; | 150 | KSharedConfigPtr m_config; | ||
151 | KSharedConfigPtr m_numLockConfig; | ||||
147 | 152 | | |||
148 | struct { | 153 | struct { | ||
149 | xkb_mod_index_t depressed = 0; | 154 | xkb_mod_index_t depressed = 0; | ||
150 | xkb_mod_index_t latched = 0; | 155 | xkb_mod_index_t latched = 0; | ||
151 | xkb_mod_index_t locked = 0; | 156 | xkb_mod_index_t locked = 0; | ||
152 | } m_modifierState; | 157 | } m_modifierState; | ||
153 | 158 | | |||
159 | enum class Ownership { | ||||
160 | Server, | ||||
161 | Client | ||||
162 | }; | ||||
163 | Ownership m_ownership = Ownership::Server; | ||||
164 | | ||||
154 | QPointer<KWayland::Server::SeatInterface> m_seat; | 165 | QPointer<KWayland::Server::SeatInterface> m_seat; | ||
155 | }; | 166 | }; | ||
156 | 167 | | |||
157 | inline | 168 | inline | ||
158 | Qt::KeyboardModifiers Xkb::modifiers() const | 169 | Qt::KeyboardModifiers Xkb::modifiers() const | ||
159 | { | 170 | { | ||
160 | return m_modifiers; | 171 | return m_modifiers; | ||
161 | } | 172 | } | ||
162 | 173 | | |||
163 | } | 174 | } | ||
164 | 175 | | |||
165 | Q_DECLARE_METATYPE(KWin::Xkb::LED) | 176 | Q_DECLARE_METATYPE(KWin::Xkb::LED) | ||
166 | Q_DECLARE_METATYPE(KWin::Xkb::LEDs) | 177 | Q_DECLARE_METATYPE(KWin::Xkb::LEDs) | ||
167 | 178 | | |||
168 | #endif | 179 | #endif |