![]() |
Deskflow 1.24.0.365
Keyboard and mouse sharing utility
|
OS X key state. More...
#include <OSXKeyState.h>


Public Types | |
| using | KeyIDs = std::vector<KeyID> |
| Public Types inherited from IKeyState | |
| using | KeyButtonSet = std::set<KeyButton> |
Public Member Functions | |
| OSXKeyState (IEventQueue *events, std::vector< std::string > layouts, bool isLangSyncEnabled) | |
| OSXKeyState (IEventQueue *events, deskflow::KeyMap &keyMap, std::vector< std::string > layouts, bool isLangSyncEnabled) | |
| ~OSXKeyState () override=default | |
modifiers | |
| void | handleModifierKeys (void *target, KeyModifierMask oldMask, KeyModifierMask newMask) |
| Handle modifier key change. | |
| Public Member Functions inherited from KeyState | |
| KeyState (IEventQueue *events, std::vector< std::string > layouts, bool isLangSyncEnabled) | |
| KeyState (IEventQueue *events, deskflow::KeyMap &keyMap, std::vector< std::string > layouts, bool isLangSyncEnabled) | |
| ~KeyState () override | |
| virtual void | onKey (KeyButton button, bool down, KeyModifierMask newState) |
| Handle key event. | |
| virtual void | sendKeyEvent (void *target, bool press, bool isAutoRepeat, KeyID key, KeyModifierMask mask, int32_t count, KeyButton button) |
| Post a key event. | |
| void | updateKeyMap (deskflow::KeyMap *existing) |
| void | updateKeyMap () override |
| Update the keyboard map. | |
| void | updateKeyState () override |
| Update the key state. | |
| void | setHalfDuplexMask (KeyModifierMask) override |
| Set half-duplex mask. | |
| void | fakeKeyDown (KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang) override |
| Fake a key press. | |
| bool | fakeKeyRepeat (KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override |
| Fake a key repeat. | |
| bool | fakeKeyUp (KeyButton button) override |
| Fake a key release. | |
| void | fakeAllKeysUp () override |
| Fake key releases for all fake pressed keys. | |
| bool | isKeyDown (KeyButton) const override |
| Test if key is pressed. | |
| KeyModifierMask | getActiveModifiers () const override |
| Get the active modifiers. | |
| int32_t | getKeyState (KeyButton keyButton) const |
| Public Member Functions inherited from IKeyState | |
| IKeyState (const IEventQueue *events) | |
| virtual | ~IKeyState ()=default |
| virtual void | clearStaleModifiers () |
| Clear stale modifiers. | |
accessors | |
| KeyModifierMask | mapModifiersFromOSX (uint32_t mask) const |
| Convert OS X modifier mask to deskflow mask. | |
| KeyModifierMask | mapModifiersToCarbon (uint32_t mask) const |
| Convert CG flags-style modifier mask to old-style Carbon. | |
| KeyButton | mapKeyFromEvent (KeyIDs &ids, KeyModifierMask *maskOut, CGEventRef event) const |
| Map key event to keys. | |
| bool | mapDeskflowHotKeyToMac (KeyID key, KeyModifierMask mask, uint32_t &macVirtualKey, uint32_t &macModifierMask) const |
| Map key and mask to native values. | |
| bool | fakeCtrlAltDel () override |
| Fake ctrl+alt+del. | |
| bool | fakeMediaKey (KeyID id) override |
| Fake a media key. | |
| KeyModifierMask | pollActiveModifiers () const override |
| Get the active modifiers from OS. | |
| int32_t | pollActiveGroup () const override |
| Get the active keyboard layout from OS. | |
| void | pollPressedKeys (KeyButtonSet &pressedKeys) const override |
| Get the keys currently pressed from OS. | |
| CGEventFlags | getModifierStateAsOSXFlags () const |
| void | getKeyMap (deskflow::KeyMap &keyMap) override |
| Get the keyboard map. | |
| void | fakeKey (const Keystroke &keystroke) override |
| Fake a key event. | |
Additional Inherited Members | |
| Static Public Attributes inherited from IKeyState | |
| static const auto | s_numButtons = 0x200 |
| using | Keystroke = deskflow::KeyMap::Keystroke |
| Protected Member Functions inherited from KeyState | |
| virtual KeyModifierMask & | getActiveModifiersRValue () |
| Get the active modifiers. | |
| int32_t | getEffectiveGroup (int32_t group, int32_t offset) const |
| Compute a group number. | |
| virtual bool | isIgnoredKey (KeyID key, KeyModifierMask mask) const |
| Check if key is ignored. | |
| KeyButton | getButton (KeyID id, int32_t group) const |
| Get button for a KeyID. | |
OS X key state.
A key state for OS X.
| using OSXKeyState::KeyIDs = std::vector<KeyID> |
| OSXKeyState::OSXKeyState | ( | IEventQueue * | events, |
| std::vector< std::string > | layouts, | ||
| bool | isLangSyncEnabled ) |
| OSXKeyState::OSXKeyState | ( | IEventQueue * | events, |
| deskflow::KeyMap & | keyMap, | ||
| std::vector< std::string > | layouts, | ||
| bool | isLangSyncEnabled ) |
|
overridedefault |
|
overridevirtual |
Fake ctrl+alt+del.
Synthesize a press of ctrl+alt+del. Return true if processing is complete and false if normal key processing should continue.
Implements KeyState.
|
overrideprotectedvirtual |
|
overridevirtual |
Fake a media key.
Synthesizes a media key down and up. Only Mac would implement this by use cocoa appkit framework.
Reimplemented from KeyState.
|
overrideprotectedvirtual |
| CGEventFlags OSXKeyState::getModifierStateAsOSXFlags | ( | ) | const |
| void OSXKeyState::handleModifierKeys | ( | void * | target, |
| KeyModifierMask | oldMask, | ||
| KeyModifierMask | newMask ) |
Handle modifier key change.
Determines which modifier keys have changed and updates the modifier state and sends key events as appropriate.
| bool OSXKeyState::mapDeskflowHotKeyToMac | ( | KeyID | key, |
| KeyModifierMask | mask, | ||
| uint32_t & | macVirtualKey, | ||
| uint32_t & | macModifierMask ) const |
Map key and mask to native values.
Calculates mac virtual key and mask for a key key and modifiers mask. Returns true if the key can be mapped, false otherwise.
| KeyButton OSXKeyState::mapKeyFromEvent | ( | KeyIDs & | ids, |
| KeyModifierMask * | maskOut, | ||
| CGEventRef | event ) const |
Map key event to keys.
Converts a key event into a sequence of KeyIDs and the shadow modifier state to a modifier mask. The KeyIDs list, in order, the characters generated by the key press/release. It returns the id of the button that was pressed or released, or 0 if the button doesn't map to a known KeyID.
| KeyModifierMask OSXKeyState::mapModifiersFromOSX | ( | uint32_t | mask | ) | const |
Convert OS X modifier mask to deskflow mask.
Returns the deskflow modifier mask corresponding to the OS X modifier mask in mask.
| KeyModifierMask OSXKeyState::mapModifiersToCarbon | ( | uint32_t | mask | ) | const |
Convert CG flags-style modifier mask to old-style Carbon.
Still required in a few places for translation calls.
|
overridevirtual |
Get the active keyboard layout from OS.
Returns the active keyboard layout according to the operating system.
Implements KeyState.
|
overridevirtual |
Get the active modifiers from OS.
Returns the modifiers that are currently active according to the operating system.
Implements KeyState.
|
overridevirtual |
Get the keys currently pressed from OS.
Adds any keys that are currently pressed according to the operating system to pressedKeys.
Implements KeyState.