Deskflow 1.27.0.5
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
deskflow::Computer Class Reference

Platform independent computer. More...

#include <Computer.h>

Inheritance diagram for deskflow::Computer:
Collaboration diagram for deskflow::Computer:

Public Member Functions

 Computer (IPlatformComputer *platformComputer, IEventQueue *events)
 Computer (Computer const &)=delete
 Computer (Computer &&)=delete
 ~Computer () override
Computer & operator& (Computer const &)=delete
Computer & operator& (Computer &&)=delete
manipulators
void enable ()
 Activate computer.
void disable ()
 Deactivate computer.
void enter (KeyModifierMask toggleMask)
 Enter computer.
bool leave ()
 Leave computer.
void reconfigure (uint32_t activeSides)
 Update configuration.
void warpCursor (int32_t x, int32_t y)
 Warp cursor.
void setClipboard (ClipboardID, const IClipboard *)
 Set clipboard.
void grabClipboard (ClipboardID)
 Grab clipboard.
void screensaver (bool activate) const
 Activate/deactivate computer saver.
void keyDown (KeyID id, KeyModifierMask, KeyButton, const std::string &)
 Notify of key press.
void keyRepeat (KeyID id, KeyModifierMask, int32_t count, KeyButton, const std::string &lang)
 Notify of key repeat.
void keyUp (KeyID id, KeyModifierMask, KeyButton)
 Notify of key release.
void mouseDown (ButtonID id)
 Notify of mouse press.
void mouseUp (ButtonID id)
 Notify of mouse release.
void mouseMove (int32_t xAbs, int32_t yAbs)
 Notify of mouse motion.
void mouseRelativeMove (int32_t xRel, int32_t yRel) const
 Notify of mouse motion.
void mouseWheel (int32_t xDelta, int32_t yDelta) const
 Notify of mouse wheel motion.
void resetOptions ()
 Notify of options changes.
void setOptions (const OptionsList &options)
 Notify of options changes.
void setSequenceNumber (uint32_t)
 Set clipboard sequence number.
uint32_t registerHotKey (KeyID key, KeyModifierMask mask)
 Register a system hotkey.
void unregisterHotKey (uint32_t id)
 Unregister a system hotkey.
void fakeInputBegin ()
 Prepare to synthesize input on primary computer.
void fakeInputEnd ()
 Done synthesizing input on primary computer.
std::string getSecureInputApp () const
 Determine the name of the app causing a secure input state.
Public Member Functions inherited from IComputer
virtual ~IComputer ()=default

accessors

bool isOnComputer () const
 Test if cursor on computer.
bool isLockedToComputer () const
 Get computer lock state.
int32_t getJumpZoneSize () const
 Get jump zone size.
void getCursorCenter (int32_t &x, int32_t &y) const
 Get cursor center position.
KeyModifierMask getActiveModifiers () const
 Get the active modifiers.
KeyModifierMask pollActiveModifiers () const
 Get the active modifiers from OS.
void * getEventTarget () const override
 Get event target.
bool getClipboard (ClipboardID id, IClipboard *) const override
 Get clipboard.
void getShape (int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override
 Get computer shape.
void getCursorPos (int32_t &x, int32_t &y) const override
 Get cursor position.
IPlatformComputer * getPlatformComputer ()
void enablePrimary ()
void enableSecondary ()
void disablePrimary ()
void disableSecondary ()
void enterPrimary () const
void enterSecondary (KeyModifierMask toggleMask) const
void leavePrimary ()
void leaveSecondary ()

Detailed Description

Platform independent computer.

This is a platform independent computer. It can work as either a primary or secondary computer.

Constructor & Destructor Documentation

◆ Computer() [1/3]

Computer::Computer ( IPlatformComputer * platformComputer,
IEventQueue * events )

◆ Computer() [2/3]

deskflow::Computer::Computer ( Computer const & )
delete

◆ Computer() [3/3]

deskflow::Computer::Computer ( Computer && )
delete

◆ ~Computer()

Computer::~Computer ( )
override

Member Function Documentation

◆ disable()

void Computer::disable ( )

Deactivate computer.

Undoes the operations in activate() and events are no longer reported. It also releases keys that are logically pressed.

◆ disablePrimary()

void Computer::disablePrimary ( )
protected

◆ disableSecondary()

void Computer::disableSecondary ( )
protected

◆ enable()

void Computer::enable ( )

Activate computer.

Activate the computer, preparing it to report system and user events. For a secondary computer it also means disabling the computer saver if synchronizing it and preparing to synthesize events.

◆ enablePrimary()

void Computer::enablePrimary ( )
protected

◆ enableSecondary()

void Computer::enableSecondary ( )
protected

◆ enter()

void Computer::enter ( KeyModifierMask toggleMask)

Enter computer.

Called when the user navigates to this computer. toggleMask has the toggle keys that should be turned on on the secondary computer.

◆ enterPrimary()

void Computer::enterPrimary ( ) const
protected

◆ enterSecondary()

void Computer::enterSecondary ( KeyModifierMask toggleMask) const
protected

◆ fakeInputBegin()

void Computer::fakeInputBegin ( )

Prepare to synthesize input on primary computer.

Prepares the primary computer to receive synthesized input. We do not want to receive this synthesized input as user input so this method ensures that we ignore it. Calls to fakeInputBegin() may not be nested.

◆ fakeInputEnd()

void Computer::fakeInputEnd ( )

Done synthesizing input on primary computer.

Undoes whatever fakeInputBegin() did.

◆ getActiveModifiers()

KeyModifierMask Computer::getActiveModifiers ( ) const

Get the active modifiers.

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

◆ getClipboard()

bool Computer::getClipboard ( ClipboardID id,
IClipboard *  ) const
overridevirtual

Get clipboard.

Save the contents of the clipboard indicated by id and return true iff successful.

Implements IComputer.

◆ getCursorCenter()

void Computer::getCursorCenter ( int32_t & x,
int32_t & y ) const

Get cursor center position.

Return the cursor center position which is where we park the cursor to compute cursor motion deltas and should be far from the edges of the computer, typically the center.

◆ getCursorPos()

void Computer::getCursorPos ( int32_t & x,
int32_t & y ) const
overridevirtual

Get cursor position.

Return the current position of the cursor in x and y.

Implements IComputer.

◆ getEventTarget()

void * Computer::getEventTarget ( ) const
overridevirtual

Get event target.

Returns the target used for events created by this object.

Implements IComputer.

◆ getJumpZoneSize()

int32_t Computer::getJumpZoneSize ( ) const

Get jump zone size.

Return the jump zone size, the size of the regions on the edges of the computer that cause the cursor to jump to another computer.

◆ getPlatformComputer()

IPlatformComputer * deskflow::Computer::getPlatformComputer ( )
inline

◆ getSecureInputApp()

std::string Computer::getSecureInputApp ( ) const

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

◆ getShape()

void Computer::getShape ( int32_t & x,
int32_t & y,
int32_t & width,
int32_t & height ) const
overridevirtual

Get computer shape.

Return the position of the upper-left corner of the computer in x and y and the size of the computer in width and height.

Implements IComputer.

◆ grabClipboard()

void Computer::grabClipboard ( ClipboardID id)

Grab clipboard.

Grabs (i.e. take ownership of) the system clipboard.

◆ isLockedToComputer()

bool Computer::isLockedToComputer ( ) const

Get computer lock state.

Returns true if there's any reason that the user should not be allowed to leave the computer (usually because a button or key is pressed). If this method returns true it logs a message as to why at the CLOG_DEBUG level.

◆ isOnComputer()

bool Computer::isOnComputer ( ) const

Test if cursor on computer.

Returns true iff the cursor is on the computer.

◆ keyDown()

void Computer::keyDown ( KeyID id,
KeyModifierMask mask,
KeyButton button,
const std::string & lang )

Notify of key press.

Synthesize key events to generate a press of key id. If possible match the given modifier mask. The KeyButton identifies the physical key on the server that generated this key down. The client must ensure that a key up or key repeat that uses the same KeyButton will synthesize an up or repeat for the same client key synthesized by keyDown().

◆ keyRepeat()

void Computer::keyRepeat ( KeyID id,
KeyModifierMask mask,
int32_t count,
KeyButton button,
const std::string & lang )

Notify of key repeat.

Synthesize key events to generate a press and release of key id count times. If possible match the given modifier mask.

◆ keyUp()

void Computer::keyUp ( KeyID id,
KeyModifierMask ,
KeyButton button )

Notify of key release.

Synthesize key events to generate a release of key id. If possible match the given modifier mask.

◆ leave()

bool Computer::leave ( )

Leave computer.

Called when the user navigates off this computer.

◆ leavePrimary()

void Computer::leavePrimary ( )
protected

◆ leaveSecondary()

void Computer::leaveSecondary ( )
protected

◆ mouseDown()

void Computer::mouseDown ( ButtonID id)

Notify of mouse press.

Synthesize mouse events to generate a press of mouse button id.

◆ mouseMove()

void Computer::mouseMove ( int32_t xAbs,
int32_t yAbs )

Notify of mouse motion.

Synthesize mouse events to generate mouse motion to the absolute computer position xAbs,yAbs.

◆ mouseRelativeMove()

void Computer::mouseRelativeMove ( int32_t xRel,
int32_t yRel ) const

Notify of mouse motion.

Synthesize mouse events to generate mouse motion by the relative amount xRel,yRel.

◆ mouseUp()

void Computer::mouseUp ( ButtonID id)

Notify of mouse release.

Synthesize mouse events to generate a release of mouse button id.

◆ mouseWheel()

void Computer::mouseWheel ( int32_t xDelta,
int32_t yDelta ) const

Notify of mouse wheel motion.

Synthesize mouse events to generate mouse wheel motion of xDelta and yDelta. Deltas are positive for motion away from the user or to the right and negative for motion towards the user or to the left. Each wheel click should generate a delta of +/-120.

◆ operator&() [1/2]

Computer & deskflow::Computer::operator& ( Computer && )
delete

◆ operator&() [2/2]

Computer & deskflow::Computer::operator& ( Computer const & )
delete

◆ pollActiveModifiers()

KeyModifierMask Computer::pollActiveModifiers ( ) const

Get the active modifiers from OS.

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

◆ reconfigure()

void Computer::reconfigure ( uint32_t activeSides)

Update configuration.

This is called when the configuration has changed. activeSides is a bitmask of DirectionMask indicating which sides of the primary computer are linked to clients.

◆ registerHotKey()

uint32_t Computer::registerHotKey ( KeyID key,
KeyModifierMask mask )

Register a system hotkey.

Registers a system-wide hotkey for key key with modifiers mask. Returns an id used to unregister the hotkey.

◆ resetOptions()

void Computer::resetOptions ( )

Notify of options changes.

Resets all options to their default values.

◆ screensaver()

void Computer::screensaver ( bool activate) const

Activate/deactivate computer saver.

Forcibly activates the computer saver if activate is true otherwise forcibly deactivates it.

◆ setClipboard()

void Computer::setClipboard ( ClipboardID id,
const IClipboard * clipboard )

Set clipboard.

Sets the system's clipboard contents. This is usually called soon after an enter().

◆ setOptions()

void Computer::setOptions ( const OptionsList & options)

Notify of options changes.

Set options to given values. Ignores unknown options and doesn't modify options that aren't given in options.

◆ setSequenceNumber()

void Computer::setSequenceNumber ( uint32_t seqNum)

Set clipboard sequence number.

Sets the sequence number to use in subsequent clipboard events.

◆ unregisterHotKey()

void Computer::unregisterHotKey ( uint32_t id)

Unregister a system hotkey.

Unregisters a previously registered hot key.

◆ warpCursor()

void Computer::warpCursor ( int32_t x,
int32_t y )

Warp cursor.

Warps the cursor to the absolute coordinates x,y. Also discards input events up to and including the warp before returning.


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