diff options
| author | BossCode45 <human.cyborg42@gmail.com> | 2023-08-15 21:27:51 +1200 |
|---|---|---|
| committer | BossCode45 <human.cyborg42@gmail.com> | 2023-08-15 21:27:51 +1200 |
| commit | ea569d9c9c61eb26f7d325b41d8ac839dc470eec (patch) | |
| tree | 33c15ab71f81e6647d904f3133b16afd87c836ed /keybinds.h | |
| parent | 37a2725da41e363fcdca12d0374b192cd03905d0 (diff) | |
| download | YATwm-ea569d9c9c61eb26f7d325b41d8ac839dc470eec.tar.gz YATwm-ea569d9c9c61eb26f7d325b41d8ac839dc470eec.zip | |
feat: Made the bind modes work
Numlock still seems to mess with keybindings.
Also switched from storing keybinds with KeySym to KeyCode
Diffstat (limited to 'keybinds.h')
| -rw-r--r-- | keybinds.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -13,7 +13,7 @@ #include "util.h" struct Keybind { - KeySym key; + KeyCode key; unsigned int modifiers; bool operator<(const Keybind &o) const; bool operator==(const Keybind &o) const; @@ -28,6 +28,7 @@ struct KeyFunction #define getKeymap(X) \ keyMaps.find(X)->second + class KeybindsModule { public: @@ -35,12 +36,17 @@ public: ~KeybindsModule() = default; const void bind(const CommandArg* argv); const void quitKey(const CommandArg* argv); + const void bindMode(const CommandArg* argv); const void handleKeypress(XKeyEvent e); const void clearKeybinds(); private: Keybind getKeybind(std::string bindString); void changeMap(int newMapID); std::map<int, std::map<Keybind, KeyFunction>> keyMaps; + const Keybind emacsBindMode(std::string bindString); + const Keybind normalBindMode(std::string bindString); + std::map<std::string, const Keybind(KeybindsModule::*)(std::string bindString)> bindModes; + const Keybind(KeybindsModule::* bindFunc)(std::string bindString); // Modifier keys to ignore when canceling a keymap KeyCode ignoredKeys[8] = {50, 37, 133, 64, 62, 105, 134, 108}; int currentMapID = 0; |
