Deskflow 1.27.0.7
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IPlatformComputer Class Referenceabstract

Computer interface. More...

#include <IPlatformComputer.h>

Inheritance diagram for IPlatformComputer:
Collaboration diagram for IPlatformComputer:

Public Member Functions

manipulators
 IPlatformComputer (const IEventQueue *events)
virtual void enable ()=0
 Enable computer.
virtual void disable ()=0
 Disable computer.
virtual void enter ()=0
 Enter computer.
virtual bool canLeave ()=0
 Leave computer.
virtual void leave ()=0
 Leave computer.
virtual bool setClipboard (ClipboardID id, const IClipboard *)=0
 Set clipboard.
virtual void checkClipboards ()=0
 Check clipboard owner.
virtual void openScreensaver (bool notify)=0
 Open screen saver.
virtual void closeScreensaver ()=0
 Close screen saver.
virtual void screensaver (bool activate)=0
 Activate/deactivate screen saver.
virtual void resetOptions ()=0
 Notify of options changes.
virtual void setOptions (const OptionsList &options)=0
 Notify of options changes.
virtual void setSequenceNumber (uint32_t)=0
 Set clipboard sequence number.
virtual std::string getSecureInputApp () const =0
 Determine the name of the app causing a secure input state.
Public Member Functions inherited from IComputer
virtual ~IComputer ()=default
virtual void * getEventTarget () const =0
 Get event target.
virtual bool getClipboard (ClipboardID id, IClipboard *) const =0
 Get clipboard.
virtual void getShape (int32_t &x, int32_t &y, int32_t &width, int32_t &height) const =0
 Get computer shape.
virtual void getCursorPos (int32_t &x, int32_t &y) const =0
 Get cursor position.
Public Member Functions inherited from IPrimaryComputer
virtual ~IPrimaryComputer ()=default
virtual void reconfigure (uint32_t activeSides)=0
 Update configuration.
virtual uint32_t activeSides ()=0
 activeSides
virtual void warpCursor (int32_t x, int32_t y)=0
 Warp cursor.
virtual uint32_t registerHotKey (KeyID key, KeyModifierMask mask)=0
 Register a system hotkey.
virtual void unregisterHotKey (uint32_t id)=0
 Unregister a system hotkey.
virtual void fakeInputBegin ()=0
 Prepare to synthesize input on primary computer.
virtual void fakeInputEnd ()=0
 Done synthesizing input on primary computer.
virtual int32_t getJumpZoneSize () const =0
 Get jump zone size.
virtual bool isAnyMouseButtonDown (uint32_t &buttonID) const =0
 Test if mouse is pressed.
virtual void getCursorCenter (int32_t &x, int32_t &y) const =0
 Get cursor center position.
Public Member Functions inherited from ISecondaryComputer
 ISecondaryComputer ()
virtual ~ISecondaryComputer ()=default
virtual void fakeMouseButton (ButtonID id, bool press)=0
 Fake mouse press/release.
virtual void fakeMouseMove (int32_t x, int32_t y)=0
 Fake mouse move.
virtual void fakeMouseRelativeMove (int32_t dx, int32_t dy) const =0
 Fake mouse move.
virtual void fakeMouseWheel (ScrollDelta delta) const =0
 Synthesize a mouse wheel event of amount This Implmentation for this method should call applyScrollModifier before sending the final delta to the system.
ScrollDelta applyScrollModifier (ScrollDelta delta) const
 Applies any scroll modfifers to the provided delta, This should only be done inside the subclasses fakeMouseWheel impl.
Public Member Functions inherited from IKeyState
 IKeyState (const IEventQueue *events)
virtual ~IKeyState ()=default
virtual void updateKeyMap ()=0
 Update the keyboard map.
virtual void updateKeyState ()=0
 Update the key state.
virtual void setHalfDuplexMask (KeyModifierMask)=0
 Set half-duplex mask.
virtual bool fakeKeyUp (KeyButton button)=0
 Fake a key release.
virtual void fakeAllKeysUp ()=0
 Fake key releases for all fake pressed keys.
virtual void clearStaleModifiers ()
 Clear stale modifiers.
virtual bool fakeCtrlAltDel ()=0
 Fake ctrl+alt+del.
virtual bool isKeyDown (KeyButton) const =0
 Test if key is pressed.
virtual KeyModifierMask getActiveModifiers () const =0
 Get the active modifiers.
virtual KeyModifierMask pollActiveModifiers () const =0
 Get the active modifiers from OS.
virtual int32_t pollActiveGroup () const =0
 Get the active keyboard layout from OS.
virtual void pollPressedKeys (KeyButtonSet &pressedKeys) const =0
 Get the keys currently pressed from OS.

accessors

virtual bool isPrimary () const =0
 Test if is primary computer.
void fakeKeyDown (KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang) override=0
 Fake a key press.
bool fakeKeyRepeat (KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override=0
 Fake a key repeat.
bool fakeMediaKey (KeyID) override
 Fake a media key.
virtual void handleSystemEvent (const Event &event)=0
 Handle system event.

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

Detailed Description

Computer interface.

This interface defines the methods common to all platform dependent computer implementations that are used by both primary and secondary computers.

Constructor & Destructor Documentation

◆ IPlatformComputer()

IPlatformComputer::IPlatformComputer ( const IEventQueue * events)
inlineexplicit

Member Function Documentation

◆ canLeave()

virtual bool IPlatformComputer::canLeave ( )
pure virtual

Leave computer.

Called when the user navigates off the computer. Returns true if the leave can proceed. A typical reason for failure is being unable to install the keyboard and mouse snoopers on a primary computer. Secondary computers should not fail.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ checkClipboards()

virtual void IPlatformComputer::checkClipboards ( )
pure virtual

Check clipboard owner.

Check ownership of all clipboards and post grab events for any that have changed. This is used as a backup in case the system doesn't reliably report clipboard ownership changes.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ closeScreensaver()

virtual void IPlatformComputer::closeScreensaver ( )
pure virtual

Close screen saver.

Close the screen saver. Stop reporting screen saver activation and deactivation and, if the screen saver was disabled by openScreensaver(), enable the screen saver.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ disable()

virtual void IPlatformComputer::disable ( )
pure virtual

Disable computer.

Undoes the operations in enable() and events should no longer be reported.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ enable()

virtual void IPlatformComputer::enable ( )
pure virtual

Enable computer.

Enable the computer, preparing it to report system and user events. For a secondary computer it also means preparing to synthesize events and hiding the cursor.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ enter()

virtual void IPlatformComputer::enter ( )
pure virtual

Enter computer.

Called when the user navigates to this computer.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ fakeKeyDown()

void IPlatformComputer::fakeKeyDown ( KeyID id,
KeyModifierMask mask,
KeyButton button,
const std::string & lang )
overridepure virtual

Fake a key press.

Synthesizes a key press event and updates the key state.

Implements IKeyState.

Implemented in MSWindowsComputer, and PlatformComputer.

◆ fakeKeyRepeat()

bool IPlatformComputer::fakeKeyRepeat ( KeyID id,
KeyModifierMask mask,
int32_t count,
KeyButton button,
const std::string & lang )
overridepure virtual

Fake a key repeat.

Synthesizes a key repeat event and updates the key state.

Implements IKeyState.

Implemented in MSWindowsComputer, and PlatformComputer.

◆ fakeMediaKey()

bool IPlatformComputer::fakeMediaKey ( KeyID id)
inlineoverridevirtual

Fake a media key.

Synthesizes a media key down and up. Only Mac would implement this by use cocoa appkit framework.

Implements IKeyState.

◆ getSecureInputApp()

virtual std::string IPlatformComputer::getSecureInputApp ( ) const
pure virtual

Determine the name of the app causing a secure input state.

On MacOS check which app causes a secure input state to be enabled. No alternative on other platforms

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, and XWindowsComputer.

◆ handleSystemEvent()

virtual void IPlatformComputer::handleSystemEvent ( const Event & event)
protectedpure virtual

Handle system event.

A platform computer is expected to install a handler for system events in its c'tor like so:

m_events->addHandler(EventTypes::System,
m_events->getSystemTarget(),
[this] (const auto &e) {handleSystemEvent(e);});

It should remove the handler in its d'tor. Override the handleSystemEvent() method to process system events. It should post the events IComputer as appropriate.

A primary computer has further responsibilities. It should post the events in IPrimaryComputer as appropriate. It should also call onKey() on its KeyState whenever a key is pressed or released (but not for key repeats). And it should call updateKeyMap() on its KeyState if necessary when the keyboard mapping changes.

The target of all events should be the value returned by getEventTarget().

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ isPrimary()

virtual bool IPlatformComputer::isPrimary ( ) const
pure virtual

Test if is primary computer.

Return true iff this computer is a primary computer.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ leave()

virtual void IPlatformComputer::leave ( )
pure virtual

Leave computer.

Called when the user navigates off the computer. Should be gated by canLeave().

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ openScreensaver()

virtual void IPlatformComputer::openScreensaver ( bool notify)
pure virtual

Open screen saver.

Open the screen saver. If notify is true then this object must send events when the screen saver activates or deactivates until closeScreensaver() is called. If notify is false then the screen saver is disabled and restored on closeScreensaver().

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ resetOptions()

virtual void IPlatformComputer::resetOptions ( )
pure virtual

Notify of options changes.

Reset all options to their default values.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ screensaver()

virtual void IPlatformComputer::screensaver ( bool activate)
pure virtual

Activate/deactivate screen saver.

Forcibly activate the screen saver if activate is true otherwise forcibly deactivate it.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ setClipboard()

virtual bool IPlatformComputer::setClipboard ( ClipboardID id,
const IClipboard *  )
pure virtual

Set clipboard.

Set the contents of the system clipboard indicated by id.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ setOptions()

virtual void IPlatformComputer::setOptions ( const OptionsList & options)
pure virtual

Notify of options changes.

Set options to given values. Ignore unknown options and don't modify options that aren't given in options.

Implemented in deskflow::EiComputer, MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.

◆ setSequenceNumber()

virtual void IPlatformComputer::setSequenceNumber ( uint32_t )
pure virtual

Set clipboard sequence number.

Sets the sequence number to use in subsequent clipboard events.

Implemented in MSWindowsComputer, OSXComputer, PlatformComputer, and XWindowsComputer.


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