Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
XWindowsKeyState Class Reference

X Windows key state. More...

#include <XWindowsKeyState.h>

Inheritance diagram for XWindowsKeyState:
Collaboration diagram for XWindowsKeyState:

Public Types

using KeycodeList = std::vector<int>
Public Types inherited from IKeyState
using KeyButtonSet = std::set<KeyButton>

Public Member Functions

 XWindowsKeyState (Display *, bool useXKB, IEventQueue *events)
 XWindowsKeyState (Display *, bool useXKB, IEventQueue *events, deskflow::KeyMap &keyMap)
 ~XWindowsKeyState () override
modifiers
void setActiveGroup (int32_t group)
 Set active group.
void setAutoRepeat (const XKeyboardState &)
 Set the auto-repeat state.
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 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.
int32_t getKeyState (KeyButton keyButton) const
Public Member Functions inherited from IKeyState
 IKeyState (const IEventQueue *events)
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

Static Public Attributes

static const auto s_groupPoll = -1
static const auto s_groupPollAndSet = -2
Static Public Attributes inherited from IKeyState
static const auto s_numButtons = 0x200

accessors

KeyModifierMask mapModifiersFromX (unsigned int state) const
 Convert X modifier mask to deskflow mask.
bool mapModifiersToX (KeyModifierMask, unsigned int &) const
 Convert deskflow modifier mask to X mask.
void mapKeyToKeycodes (KeyID key, KeycodeList &keycodes) const
 Convert deskflow key to all corresponding X keycodes.
bool fakeCtrlAltDel () override
 Fake ctrl+alt+del.
KeyModifierMask pollActiveModifiers () const override
 Get the active modifiers from OS.
int32_t pollActiveGroup () const final
 Get the active keyboard layout from OS.
void pollPressedKeys (KeyButtonSet &pressedKeys) const override
 Get the keys currently pressed from OS.
void getKeyMap (deskflow::KeyMap &keyMap) override
 Get the keyboard map.
void fakeKey (const Keystroke &keystroke) override
 Fake a key event.

Additional Inherited Members

using Keystroke = deskflow::KeyMap::Keystroke
Protected Member Functions inherited from KeyState
virtual KeyModifierMaskgetActiveModifiersRValue ()
 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.

Detailed Description

X Windows key state.

A key state for X Windows.

Member Typedef Documentation

◆ KeycodeList

using XWindowsKeyState::KeycodeList = std::vector<int>

Constructor & Destructor Documentation

◆ XWindowsKeyState() [1/2]

XWindowsKeyState::XWindowsKeyState ( Display * display,
bool useXKB,
IEventQueue * events )

◆ XWindowsKeyState() [2/2]

XWindowsKeyState::XWindowsKeyState ( Display * display,
bool useXKB,
IEventQueue * events,
deskflow::KeyMap & keyMap )

◆ ~XWindowsKeyState()

XWindowsKeyState::~XWindowsKeyState ( )
override

Member Function Documentation

◆ fakeCtrlAltDel()

bool XWindowsKeyState::fakeCtrlAltDel ( )
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.

◆ fakeKey()

void XWindowsKeyState::fakeKey ( const Keystroke & keystroke)
overrideprotectedvirtual

Fake a key event.

Synthesize an event for keystroke.

Implements KeyState.

◆ getKeyMap()

void XWindowsKeyState::getKeyMap ( deskflow::KeyMap & keyMap)
overrideprotectedvirtual

Get the keyboard map.

Fills keyMap with the current keyboard map.

Implements KeyState.

◆ mapKeyToKeycodes()

void XWindowsKeyState::mapKeyToKeycodes ( KeyID key,
KeycodeList & keycodes ) const

Convert deskflow key to all corresponding X keycodes.

Converts the deskflow key key to all of the keycodes that map to that key.

◆ mapModifiersFromX()

KeyModifierMask XWindowsKeyState::mapModifiersFromX ( unsigned int state) const

Convert X modifier mask to deskflow mask.

Returns the deskflow modifier mask corresponding to the X modifier mask in state.

◆ mapModifiersToX()

bool XWindowsKeyState::mapModifiersToX ( KeyModifierMask mask,
unsigned int & modifiers ) const

Convert deskflow modifier mask to X mask.

Converts the deskflow modifier mask to the corresponding X modifier mask. Returns true if successful and false if any modifier could not be converted.

◆ pollActiveGroup()

int32_t XWindowsKeyState::pollActiveGroup ( ) const
finalvirtual

Get the active keyboard layout from OS.

Returns the active keyboard layout according to the operating system.

Implements KeyState.

◆ pollActiveModifiers()

KeyModifierMask XWindowsKeyState::pollActiveModifiers ( ) const
overridevirtual

Get the active modifiers from OS.

Returns the modifiers that are currently active according to the operating system.

Implements KeyState.

◆ pollPressedKeys()

void XWindowsKeyState::pollPressedKeys ( KeyButtonSet & pressedKeys) const
overridevirtual

Get the keys currently pressed from OS.

Adds any keys that are currently pressed according to the operating system to pressedKeys.

Implements KeyState.

◆ setActiveGroup()

void XWindowsKeyState::setActiveGroup ( int32_t group)

Set active group.

Sets the active group to group. This is the group returned by pollActiveGroup(). If group is s_groupPoll then pollActiveGroup() will really poll, but that's a slow operation on X11. If group is s_groupPollAndSet then this will poll the active group now and use it for future calls to pollActiveGroup().

◆ setAutoRepeat()

void XWindowsKeyState::setAutoRepeat ( const XKeyboardState & state)

Set the auto-repeat state.

Sets the auto-repeat state.

Member Data Documentation

◆ s_groupPoll

const auto XWindowsKeyState::s_groupPoll = -1
inlinestatic

◆ s_groupPollAndSet

const auto XWindowsKeyState::s_groupPollAndSet = -2
inlinestatic

The documentation for this class was generated from the following files: