CKeyState Class Reference

Core key state. More...

#include <CKeyState.h>

Inherits IKeyState.

Inherited by CMSWindowsKeyState, COSXKeyState, and CXWindowsKeyState.

Inheritance diagram for CKeyState:

Inheritance graph
[legend]
Collaboration diagram for CKeyState:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CKeyState ()
virtual ~CKeyState ()
virtual void updateKeyMap ()
 Update the keyboard map.
virtual void updateKeyState ()
 Update the key state.
virtual void setHalfDuplexMask (KeyModifierMask)
 Set half-duplex mask.
virtual void fakeKeyDown (KeyID id, KeyModifierMask mask, KeyButton button)
 Fake a key press.
virtual void fakeKeyRepeat (KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button)
 Fake a key repeat.
virtual void fakeKeyUp (KeyButton button)
 Fake a key release.
virtual void fakeAllKeysUp ()
 Fake key releases for all fake pressed keys.
virtual bool fakeCtrlAltDel ()=0
 Fake ctrl+alt+del.
virtual bool isKeyDown (KeyButton) const
 Test if key is pressed.
virtual KeyModifierMask getActiveModifiers () const
 Get the active modifiers.
virtual KeyModifierMask pollActiveModifiers () const =0
 Get the active modifiers from OS.
virtual SInt32 pollActiveGroup () const =0
 Get the active keyboard layout from OS.
virtual void pollPressedKeys (KeyButtonSet &pressedKeys) const =0
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, SInt32 count, KeyButton button)
 Post a key event.

Protected Types

typedef CKeyMap::Keystroke Keystroke

Protected Member Functions

protected manipulators
virtual void getKeyMap (CKeyMap &keyMap)=0
 Get the keyboard map.
virtual void fakeKey (const Keystroke &keystroke)=0
 Fake a key event.
virtual KeyModifierMask & getActiveModifiersRValue ()
 Get the active modifiers.
protected accessors
SInt32 getEffectiveGroup (SInt32 group, SInt32 offset) const
 Compute a group number.
virtual bool isIgnoredKey (KeyID key, KeyModifierMask mask) const
 Check if key is ignored.
KeyButton getButton (KeyID id, SInt32 group) const
 Get button for a KeyID.

Classes

class  ButtonToKeyLess
struct  CAddActiveModifierContext

Detailed Description

Core key state.

This class provides key state services. Subclasses must implement a few platform specific methods.

Definition at line 26 of file CKeyState.h.


Member Function Documentation

void CKeyState::fakeAllKeysUp (  )  [virtual]

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.

Definition at line 665 of file CKeyState.cpp.

References pollActiveModifiers().

virtual bool CKeyState::fakeCtrlAltDel (  )  [pure 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 CMSWindowsKeyState, COSXKeyState, and CXWindowsKeyState.

virtual void CKeyState::fakeKey ( const Keystroke keystroke  )  [protected, pure virtual]

Fake a key event.

Synthesize an event for keystroke.

void CKeyState::fakeKeyDown ( KeyID  id,
KeyModifierMask  mask,
KeyButton  button 
) [virtual]

Fake a key press.

Synthesizes a key press event and updates the key state.

Implements IKeyState.

Reimplemented in CMSWindowsKeyState.

Definition at line 524 of file CKeyState.cpp.

References fakeKeyRepeat(), getActiveModifiersRValue(), isIgnoredKey(), CKeyMap::KeyItem::m_button, CKeyMap::KeyItem::m_client, CKeyMap::mapKey(), and pollActiveGroup().

Referenced by CMSWindowsKeyState::fakeKeyDown().

void CKeyState::fakeKeyRepeat ( KeyID  id,
KeyModifierMask  mask,
SInt32  count,
KeyButton  button 
) [virtual]

Fake a key repeat.

Synthesizes a key repeat event and updates the key state.

Implements IKeyState.

Reimplemented in CMSWindowsKeyState.

Definition at line 564 of file CKeyState.cpp.

References getActiveModifiersRValue(), CKeyMap::Keystroke::kButton, CKeyMap::KeyItem::m_button, CKeyMap::KeyItem::m_client, CKeyMap::mapKey(), and pollActiveGroup().

Referenced by fakeKeyDown(), and CMSWindowsKeyState::fakeKeyRepeat().

void CKeyState::fakeKeyUp ( KeyButton  button  )  [virtual]

Fake a key release.

Synthesizes a key release event and updates the key state.

Implements IKeyState.

Definition at line 625 of file CKeyState.cpp.

KeyModifierMask CKeyState::getActiveModifiers (  )  const [virtual]

Get the active modifiers.

Returns the modifiers that are currently active according to our shadowed state.

Implements IKeyState.

Definition at line 688 of file CKeyState.cpp.

Referenced by CMSWindowsKeyState::fakeKey(), COSXKeyState::mapKeyFromEvent(), CMSWindowsKeyState::mapKeyFromEvent(), CMSWindowsKeyState::saveModifiers(), and CMSWindowsKeyState::useSavedModifiers().

KeyModifierMask & CKeyState::getActiveModifiersRValue (  )  [protected, virtual]

Get the active modifiers.

Returns the modifiers that are currently active according to our shadowed state. The state may be modified.

Reimplemented in CMSWindowsKeyState.

Definition at line 694 of file CKeyState.cpp.

Referenced by fakeKeyDown(), fakeKeyRepeat(), and CMSWindowsKeyState::getActiveModifiersRValue().

KeyButton CKeyState::getButton ( KeyID  id,
SInt32  group 
) const [protected]

Get button for a KeyID.

Return the button mapped to key id in group group if any, otherwise returns 0.

Definition at line 720 of file CKeyState.cpp.

References CKeyMap::findCompatibleKey().

Referenced by COSXKeyState::mapSynergyHotKeyToMac().

SInt32 CKeyState::getEffectiveGroup ( SInt32  group,
SInt32  offset 
) const [protected]

Compute a group number.

Returns the number of the group offset groups after group group.

Definition at line 700 of file CKeyState.cpp.

References CKeyMap::getEffectiveGroup().

Referenced by COSXKeyState::fakeKey(), and CMSWindowsKeyState::fakeKey().

virtual void CKeyState::getKeyMap ( CKeyMap keyMap  )  [protected, pure virtual]

Get the keyboard map.

Fills keyMap with the current keyboard map.

Implemented in CMSWindowsKeyState, COSXKeyState, and CXWindowsKeyState.

Referenced by updateKeyMap().

bool CKeyState::isIgnoredKey ( KeyID  key,
KeyModifierMask  mask 
) const [protected, virtual]

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.

Definition at line 706 of file CKeyState.cpp.

Referenced by fakeKeyDown().

bool CKeyState::isKeyDown ( KeyButton   )  const [virtual]

Test if key is pressed.

Returns true iff the given key is down. Half-duplex toggles always return false.

Implements IKeyState.

Definition at line 682 of file CKeyState.cpp.

Referenced by CMSWindowsKeyState::pollActiveModifiers().

void CKeyState::onKey ( KeyButton  button,
bool  down,
KeyModifierMask  newState 
) [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 CMSWindowsKeyState.

Definition at line 395 of file CKeyState.cpp.

Referenced by CXWindowsScreen::handleSystemEvent(), and CMSWindowsKeyState::onKey().

virtual SInt32 CKeyState::pollActiveGroup (  )  const [pure virtual]

Get the active keyboard layout from OS.

Returns the active keyboard layout according to the operating system.

Implements IKeyState.

Implemented in CMSWindowsKeyState, COSXKeyState, and CXWindowsKeyState.

Referenced by fakeKeyDown(), fakeKeyRepeat(), and updateKeyState().

virtual KeyModifierMask CKeyState::pollActiveModifiers (  )  const [pure virtual]

Get the active modifiers from OS.

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

Implements IKeyState.

Implemented in CMSWindowsKeyState, COSXKeyState, and CXWindowsKeyState.

Referenced by fakeAllKeysUp(), and updateKeyState().

void CKeyState::sendKeyEvent ( void *  target,
bool  press,
bool  isAutoRepeat,
KeyID  key,
KeyModifierMask  mask,
SInt32  count,
KeyButton  button 
) [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 CMSWindowsKeyState.

Definition at line 419 of file CKeyState.cpp.

References IKeyState::getKeyDownEvent(), IKeyState::getKeyRepeatEvent(), IKeyState::getKeyUpEvent(), and CKeyMap::isHalfDuplex().

Referenced by CMSWindowsKeyState::sendKeyEvent().

void CKeyState::setHalfDuplexMask ( KeyModifierMask   )  [virtual]

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.

Definition at line 509 of file CKeyState.cpp.

References CKeyMap::addHalfDuplexModifier(), and CKeyMap::clearHalfDuplexModifiers().

void CKeyState::updateKeyMap (  )  [virtual]

Update the keyboard map.

Causes the key state to get updated to reflect the current keyboard mapping.

Implements IKeyState.

Definition at line 452 of file CKeyState.cpp.

References CKeyMap::finish(), getKeyMap(), and CKeyMap::swap().

void CKeyState::updateKeyState (  )  [virtual]

Update the key state.

Causes the key state to get updated to reflect the physical keyboard state.

Implements IKeyState.

Definition at line 467 of file CKeyState.cpp.

References CKeyMap::foreachKey(), pollActiveGroup(), and pollActiveModifiers().


The documentation for this class was generated from the following files:
Generated on Fri Nov 6 00:19:03 2009 for synergy-plus by  doxygen 1.4.7