|
The Pedigree Project 0.1
|
#include <KeymapManager.h>
Collaboration diagram for KeymapManager:Classes | |
| struct | KeymapEntry |
| Structure representing an entry in the keymap table. More... | |
| struct | KeyState |
| struct | SparseEntry |
| Structure representing an entry in the sparse table. More... | |
Public Types | |
| enum | EscapeState { EscapeNone = 0 , EscapeE0 , EscapeE1 } |
Public Member Functions | |
| KeymapManager () | |
| Default constructor. | |
| virtual | ~KeymapManager () |
| Default destructor. | |
| void | useKeymap (uint8_t *pSparseTable, uint8_t *pDataTable) |
| Changes the current keymap to the given one. | |
| bool | useCompiledKeymap (uint32_t *pCompiledKeymap, size_t keymapLength) |
| Changes the current keymap to the given (compiled) one. | |
| bool | handleHidModifier (uint8_t keyCode, bool bDown) |
| uint64_t | resolveHidKeycode (uint8_t keyCode) |
| uint8_t | convertPc102ScancodeToHidKeycode (uint8_t scancode, EscapeState &escape) |
| Converts a pc102 scancode into a HID keycode. | |
| KeymapEntry * | getKeymapEntry (bool bCtrl, bool bShift, bool bAlt, bool bAltGr, uint8_t nCombinator, uint8_t keyCode) |
| Returns the keymap entry corresponding to given keycode and modifiers. | |
Static Public Member Functions | |
| static KeymapManager & | instance () |
| Singleton design. | |
Private Types | |
| enum | IndexModifiers { IndexCtrl = 1 , IndexShift = 2 , IndexAlt = 4 , IndexAltGr = 8 } |
| enum | HidModifiers { HidCapsLock = 0x39 , HidLeftCtrl = 0xE0 , HidLeftShift = 0xE1 , HidLeftAlt = 0xE2 , HidLeftGui = 0xE3 , HidRightCtrl = 0xE4 , HidRightShift = 0xE5 , HidRightAlt = 0xE6 , HidRightGui = 0xE7 } |
| HID keycodes corresponding to modifiers. More... | |
Private Attributes | |
| SparseEntry * | m_pSparseTable |
| The sparse and data tables for the current keymap. | |
| KeymapEntry * | m_pDataTable |
| bool | m_bLeftCtrl |
| State of the modifiers, true if down, false if up. | |
| bool | m_bLeftShift |
| bool | m_bLeftAlt |
| bool | m_bRightCtrl |
| bool | m_bRightShift |
| bool | m_bRightAlt |
| bool | m_bCapsLock |
| True if caps lock is on. | |
| uint8_t | m_nCombinator |
| Index of the current active combinator, if any. | |
| Tree< uint8_t, KeyState * > | m_KeyStates |
| Current key states (for periodic callbacks while a key is down) | |
| Spinlock | m_KeyLock |
| bool | m_bHaveLoadedKeymap |
Static Private Attributes | |
| static KeymapManager | m_Instance |
| Static instance. | |
Global manager for keymaps
Definition at line 31 of file KeymapManager.h.
| enum KeymapManager::EscapeState |
Definition at line 59 of file KeymapManager.h.
|
private |
HID keycodes corresponding to modifiers.
Definition at line 83 of file KeymapManager.h.
|
private |
Definition at line 80 of file KeymapManager.h.
| KeymapManager::KeymapManager | ( | ) |
|
virtual |
Default destructor.
Definition at line 60 of file KeymapManager.cc.
| uint8_t KeymapManager::convertPc102ScancodeToHidKeycode | ( | uint8_t | scancode, |
| EscapeState & | escape | ||
| ) |
Converts a pc102 scancode into a HID keycode.
Definition at line 317 of file KeymapManager.cc.
Referenced by X86Keyboard::scancodeToAscii().
Here is the caller graph for this function:| KeymapManager::KeymapEntry * KeymapManager::getKeymapEntry | ( | bool | bCtrl, |
| bool | bShift, | ||
| bool | bAlt, | ||
| bool | bAltGr, | ||
| uint8_t | nCombinator, | ||
| uint8_t | keyCode | ||
| ) |
Returns the keymap entry corresponding to given keycode and modifiers.
Definition at line 239 of file KeymapManager.cc.
References m_pSparseTable.
Referenced by resolveHidKeycode().
Here is the caller graph for this function:| bool KeymapManager::handleHidModifier | ( | uint8_t | keyCode, |
| bool | bDown | ||
| ) |
If the given keycode is a modifier, applies it and returns true, otherwise it returns false.
Definition at line 134 of file KeymapManager.cc.
References m_bCapsLock, and m_bLeftCtrl.
Referenced by HidInputManager::keyDown().
Here is the caller graph for this function:
|
inlinestatic |
Singleton design.
Definition at line 40 of file KeymapManager.h.
Referenced by HidInputManager::keyDown(), HidInputManager::keyUp(), and X86Keyboard::scancodeToAscii().
Here is the caller graph for this function:| uint64_t KeymapManager::resolveHidKeycode | ( | uint8_t | keyCode | ) |
Resolves a HID keycode using the current keymap and returns a "real" character in UTF-32 format, plus modifier flags in the top 32-bits.
Definition at line 157 of file KeymapManager.cc.
References getKeymapEntry(), m_bCapsLock, m_bLeftCtrl, and m_nCombinator.
Referenced by HidInputManager::keyDown(), X86Keyboard::scancodeToAscii(), useCompiledKeymap(), and useKeymap().
Here is the caller graph for this function:| bool KeymapManager::useCompiledKeymap | ( | uint32_t * | pCompiledKeymap, |
| size_t | keymapLength | ||
| ) |
Changes the current keymap to the given (compiled) one.
Definition at line 91 of file KeymapManager.cc.
References HidInputManager::instance(), m_bHaveLoadedKeymap, m_pSparseTable, resolveHidKeycode(), and HidInputManager::updateKeys().
| void KeymapManager::useKeymap | ( | uint8_t * | pSparseTable, |
| uint8_t * | pDataTable | ||
| ) |
Changes the current keymap to the given one.
Definition at line 62 of file KeymapManager.cc.
References HidInputManager::instance(), m_bHaveLoadedKeymap, m_pSparseTable, resolveHidKeycode(), and HidInputManager::updateKeys().
|
private |
True if caps lock is on.
Definition at line 118 of file KeymapManager.h.
Referenced by handleHidModifier(), and resolveHidKeycode().
|
private |
Whether or not we've loaded a new keymap. Used to figure out if we can safely free the old keymap data.
Definition at line 144 of file KeymapManager.h.
Referenced by useCompiledKeymap(), and useKeymap().
|
private |
Definition at line 112 of file KeymapManager.h.
|
private |
State of the modifiers, true if down, false if up.
Definition at line 110 of file KeymapManager.h.
Referenced by handleHidModifier(), and resolveHidKeycode().
|
private |
Definition at line 111 of file KeymapManager.h.
|
private |
Definition at line 115 of file KeymapManager.h.
|
private |
Definition at line 113 of file KeymapManager.h.
|
private |
Definition at line 114 of file KeymapManager.h.
|
staticprivate |
Static instance.
Definition at line 103 of file KeymapManager.h.
|
private |
Current key states (for periodic callbacks while a key is down)
Definition at line 134 of file KeymapManager.h.
|
private |
Index of the current active combinator, if any.
Definition at line 121 of file KeymapManager.h.
Referenced by resolveHidKeycode().
|
private |
Definition at line 107 of file KeymapManager.h.
|
private |
The sparse and data tables for the current keymap.
Definition at line 106 of file KeymapManager.h.
Referenced by getKeymapEntry(), KeymapManager(), useCompiledKeymap(), and useKeymap().