The Pedigree Project
0.1
|
#include <KeymapManager.h>
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. | |
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.
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 143 of file KeymapManager.cc.
References m_bCapsLock, and m_bLeftCtrl.
Referenced by HidInputManager::keyDown(), and HidInputManager::keyUp().
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 168 of file KeymapManager.cc.
References getKeymapEntry(), m_bCapsLock, m_bLeftCtrl, and m_nCombinator.
Referenced by HidInputManager::keyDown(), X86Keyboard::scancodeToAscii(), HidInputManager::updateKeys(), useCompiledKeymap(), and useKeymap().
|
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 165 of file KeymapManager.h.
Referenced by useCompiledKeymap(), and useKeymap().
|
private |