Deskflow 1.22.0.197
Keyboard and mouse sharing utility
|
Core key state. More...
#include <KeyState.h>
Classes | |
struct | AddActiveModifierContext |
Public Member Functions | |
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 | |
manipulators | |
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. | |
Public Member Functions inherited from IKeyState | |
IKeyState (const IEventQueue *events) | |
Public Member Functions inherited from IInterface | |
virtual | ~IInterface ()=default |
Interface destructor does nothing. |
Protected Member Functions | |
protected manipulators | |
virtual void | getKeyMap (deskflow::KeyMap &keyMap)=0 |
Get the keyboard map. | |
virtual void | fakeKey (const Keystroke &keystroke)=0 |
Fake a key event. | |
virtual KeyModifierMask & | getActiveModifiersRValue () |
Get the active modifiers. |
accessors | |
using | Keystroke = deskflow::KeyMap::Keystroke |
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 | fakeMediaKey (KeyID id) override |
Fake a media key. | |
bool | isKeyDown (KeyButton) const override |
Test if key is pressed. | |
KeyModifierMask | getActiveModifiers () const override |
Get the active modifiers. | |
bool | fakeCtrlAltDel () override=0 |
Fake ctrl+alt+del. | |
KeyModifierMask | pollActiveModifiers () const override=0 |
Get the active modifiers from OS. | |
int32_t | pollActiveGroup () const override=0 |
Get the active keyboard layout from OS. | |
void | pollPressedKeys (KeyButtonSet &pressedKeys) const override=0 |
Get the keys currently pressed from OS. | |
int32_t | getKeyState (KeyButton keyButton) const |
protected accessors | |
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. |
Additional Inherited Members | |
Public Types inherited from IKeyState | |
using | KeyButtonSet = std::set<KeyButton> |
Static Public Attributes inherited from IKeyState | |
static const auto | s_numButtons = 0x200 |
Core key state.
This class provides key state services. Subclasses must implement a few platform specific methods.
|
protected |
KeyState::KeyState | ( | IEventQueue * | events, |
std::vector< std::string > | layouts, | ||
bool | isLangSyncEnabled ) |
KeyState::KeyState | ( | IEventQueue * | events, |
deskflow::KeyMap & | keyMap, | ||
std::vector< std::string > | layouts, | ||
bool | isLangSyncEnabled ) |
|
override |
|
overridevirtual |
Fake key releases for all fake pressed keys.
Synthesizes a key release event for every key that is synthetically pressed and updates the key state.
Implements IKeyState.
|
overridepure virtual |
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 IKeyState.
Implemented in deskflow::EiKeyState, MSWindowsKeyState, OSXKeyState, and XWindowsKeyState.
|
protectedpure virtual |
Fake a key event.
Synthesize an event for keystroke
.
Implemented in deskflow::EiKeyState, MSWindowsKeyState, OSXKeyState, and XWindowsKeyState.
|
overridevirtual |
Fake a key press.
Synthesizes a key press event and updates the key state.
Implements IKeyState.
Reimplemented in MSWindowsKeyState.
|
overridevirtual |
Fake a key repeat.
Synthesizes a key repeat event and updates the key state.
Implements IKeyState.
Reimplemented in MSWindowsKeyState.
|
overridevirtual |
Fake a key release.
Synthesizes a key release event and updates the key state.
Implements IKeyState.
|
overridevirtual |
Fake a media key.
Synthesizes a media key down and up. Only Mac would implement this by use cocoa appkit framework.
Implements IKeyState.
Reimplemented in OSXKeyState.
|
overridevirtual |
Get the active modifiers.
Returns the modifiers that are currently active according to our shadowed state.
Implements IKeyState.
|
protectedvirtual |
Get the active modifiers.
Returns the modifiers that are currently active according to our shadowed state. The state may be modified.
Reimplemented in MSWindowsKeyState.
Get button for a KeyID.
Return the button mapped to key id
in group group
if any, otherwise returns 0.
|
protected |
Compute a group number.
Returns the number of the group offset
groups after group group
.
|
protectedpure virtual |
Get the keyboard map.
Fills keyMap
with the current keyboard map.
Implemented in deskflow::EiKeyState, MSWindowsKeyState, OSXKeyState, and XWindowsKeyState.
|
inline |
|
protectedvirtual |
Check if key is ignored.
Returns true
if and only if the key should always be ignored. The default returns true
only for the toggle keys.
|
overridevirtual |
Test if key is pressed.
Returns true iff the given key is down. Half-duplex toggles always return false.
Implements IKeyState.
|
virtual |
Handle key event.
Sets the state of button
to down or up and updates the current modifier state to newState
. This method should be called by primary screens only in response to local events. For auto-repeat set down
to true
. Overrides must forward to the superclass.
Reimplemented in MSWindowsKeyState.
|
overridepure virtual |
Get the active keyboard layout from OS.
Returns the active keyboard layout according to the operating system.
Implements IKeyState.
Implemented in deskflow::EiKeyState, MSWindowsKeyState, OSXKeyState, and XWindowsKeyState.
|
overridepure virtual |
Get the active modifiers from OS.
Returns the modifiers that are currently active according to the operating system.
Implements IKeyState.
Implemented in deskflow::EiKeyState, MSWindowsKeyState, OSXKeyState, and XWindowsKeyState.
|
overridepure virtual |
Get the keys currently pressed from OS.
Adds any keys that are currently pressed according to the operating system to pressedKeys
.
Implements IKeyState.
Implemented in deskflow::EiKeyState, MSWindowsKeyState, OSXKeyState, and XWindowsKeyState.
|
virtual |
Post a key event.
Posts a key event. This may adjust the event or post additional events in some circumstances. If this is overridden it must forward to the superclass.
Reimplemented in MSWindowsKeyState.
|
overridevirtual |
Set half-duplex mask.
Sets which modifier toggle keys are half-duplex. A half-duplex toggle key doesn't report a key release when toggled on and doesn't report a key press when toggled off.
Implements IKeyState.
|
inlineoverridevirtual |
Update the keyboard map.
Causes the key state to get updated to reflect the current keyboard mapping.
Implements IKeyState.
void KeyState::updateKeyMap | ( | deskflow::KeyMap * | existing | ) |
|
overridevirtual |
Update the key state.
Causes the key state to get updated to reflect the physical keyboard state.
Implements IKeyState.