aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/devices/IKeyboard.hpp
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-07-25 13:02:05 +0200
committerVaxry <[email protected]>2024-07-25 13:02:10 +0200
commitdaf5fad19034def8062acfd32e66bea78c62aaff (patch)
tree566871bbe62ab75d6c5745de25c6b19a24d92441 /src/devices/IKeyboard.hpp
parent4beac91cbd791657cc53d6e483eb41bf4df1ec0c (diff)
downloadHyprland-daf5fad19034def8062acfd32e66bea78c62aaff.tar.gz
Hyprland-daf5fad19034def8062acfd32e66bea78c62aaff.zip
keyboard: properly update keymap state and fd on keymap changes
needed for virtual keyboards that impose their own layouts. fixes #6991
Diffstat (limited to 'src/devices/IKeyboard.hpp')
-rw-r--r--src/devices/IKeyboard.hpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/devices/IKeyboard.hpp b/src/devices/IKeyboard.hpp
index 1ae6c7bc..2ff8a190 100644
--- a/src/devices/IKeyboard.hpp
+++ b/src/devices/IKeyboard.hpp
@@ -61,18 +61,24 @@ class IKeyboard : public IHID {
std::string rules = "";
};
- void setKeymap(const SStringRuleNames& rules);
- void updateXKBTranslationState(xkb_keymap* const keymap = nullptr);
- std::string getActiveLayout();
- void updateLEDs();
- void updateLEDs(uint32_t leds);
- uint32_t getModifiers();
- void updateModifiers(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group);
- bool updateModifiersState(); // rets whether changed
- void updateXkbStateWithKey(uint32_t xkbKey, bool pressed);
-
- bool active = false;
- bool enabled = true;
+ void setKeymap(const SStringRuleNames& rules);
+ void updateXKBTranslationState(xkb_keymap* const keymap = nullptr);
+ std::string getActiveLayout();
+ void updateLEDs();
+ void updateLEDs(uint32_t leds);
+ uint32_t getModifiers();
+ void updateModifiers(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group);
+ bool updateModifiersState(); // rets whether changed
+ void updateXkbStateWithKey(uint32_t xkbKey, bool pressed);
+ void updateKeymapFD();
+
+ bool active = false;
+ bool enabled = true;
+
+ // if the keymap is overridden by the implementation,
+ // don't try to set keyboard rules anymore, to avoid overwriting the requested one.
+ // e.g. Virtual keyboards with custom maps.
+ bool keymapOverridden = false;
xkb_layout_index_t activeLayout = 0;
xkb_state * xkbState = nullptr, *xkbStaticState /* Static state: never gets modifiers or layout changes sent, used for keybinds. */ = nullptr;