Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
deskflow::Screen Class Reference

Platform independent screen. More...

#include <Screen.h>

Inheritance diagram for deskflow::Screen:
Collaboration diagram for deskflow::Screen:

Public Member Functions

 Screen (IPlatformScreen *platformScreen, IEventQueue *events)
 Screen (Screen const &)=delete
 Screen (Screen &&)=delete
 ~Screen () override
Screenoperator& (Screen const &)=delete
Screenoperator& (Screen &&)=delete
manipulators
void enable ()
 Activate screen.
void disable ()
 Deactivate screen.
void enter (KeyModifierMask toggleMask)
 Enter screen.
bool leave ()
 Leave screen.
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 screen 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 screen.
void fakeInputEnd ()
 Done synthesizing input on primary screen.
std::string getSecureInputApp () const
 Determine the name of the app causing a secure input state.
Public Member Functions inherited from IScreen
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

accessors

bool isOnScreen () const
 Test if cursor on screen.
bool isLockedToScreen () const
 Get screen 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 screen shape.
void getCursorPos (int32_t &x, int32_t &y) const override
 Get cursor position.
IPlatformScreengetPlatformScreen ()
void enablePrimary ()
void enableSecondary ()
void disablePrimary ()
void disableSecondary ()
void enterPrimary () const
void enterSecondary (KeyModifierMask toggleMask) const
void leavePrimary ()
void leaveSecondary ()

Detailed Description

Platform independent screen.

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

Constructor & Destructor Documentation

◆ Screen() [1/3]

Screen::Screen ( IPlatformScreen * platformScreen,
IEventQueue * events )

◆ Screen() [2/3]

deskflow::Screen::Screen ( Screen const & )
delete

◆ Screen() [3/3]

deskflow::Screen::Screen ( Screen && )
delete

◆ ~Screen()

Screen::~Screen ( )
override

Member Function Documentation

◆ disable()

void Screen::disable ( )

Deactivate screen.

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

◆ disablePrimary()

void Screen::disablePrimary ( )
protected

◆ disableSecondary()

void Screen::disableSecondary ( )
protected

◆ enable()

void Screen::enable ( )

Activate screen.

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

◆ enablePrimary()

void Screen::enablePrimary ( )
protected

◆ enableSecondary()

void Screen::enableSecondary ( )
protected

◆ enter()

void Screen::enter ( KeyModifierMask toggleMask)

Enter screen.

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

◆ enterPrimary()

void Screen::enterPrimary ( ) const
protected

◆ enterSecondary()

void Screen::enterSecondary ( KeyModifierMask toggleMask) const
protected

◆ fakeInputBegin()

void Screen::fakeInputBegin ( )

Prepare to synthesize input on primary screen.

Prepares the primary screen 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 Screen::fakeInputEnd ( )

Done synthesizing input on primary screen.

Undoes whatever fakeInputBegin() did.

◆ getActiveModifiers()

KeyModifierMask Screen::getActiveModifiers ( ) const

Get the active modifiers.

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

◆ getClipboard()

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

Get clipboard.

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

Implements IScreen.

◆ getCursorCenter()

void Screen::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 screen, typically the center.

◆ getCursorPos()

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

Get cursor position.

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

Implements IScreen.

◆ getEventTarget()

void * Screen::getEventTarget ( ) const
overridevirtual

Get event target.

Returns the target used for events created by this object.

Implements IScreen.

◆ getJumpZoneSize()

int32_t Screen::getJumpZoneSize ( ) const

Get jump zone size.

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

◆ getPlatformScreen()

IPlatformScreen * deskflow::Screen::getPlatformScreen ( )
inline

◆ getSecureInputApp()

std::string Screen::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 Screen::getShape ( int32_t & x,
int32_t & y,
int32_t & width,
int32_t & height ) const
overridevirtual

Get screen shape.

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

Implements IScreen.

◆ grabClipboard()

void Screen::grabClipboard ( ClipboardID id)

Grab clipboard.

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

◆ isLockedToScreen()

bool Screen::isLockedToScreen ( ) const

Get screen lock state.

Returns true if there's any reason that the user should not be allowed to leave the screen (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.

◆ isOnScreen()

bool Screen::isOnScreen ( ) const

Test if cursor on screen.

Returns true iff the cursor is on the screen.

◆ keyDown()

void Screen::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 Screen::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 Screen::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 Screen::leave ( )

Leave screen.

Called when the user navigates off this screen.

◆ leavePrimary()

void Screen::leavePrimary ( )
protected

◆ leaveSecondary()

void Screen::leaveSecondary ( )
protected

◆ mouseDown()

void Screen::mouseDown ( ButtonID id)

Notify of mouse press.

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

◆ mouseMove()

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

Notify of mouse motion.

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

◆ mouseRelativeMove()

void Screen::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 Screen::mouseUp ( ButtonID id)

Notify of mouse release.

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

◆ mouseWheel()

void Screen::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]

Screen & deskflow::Screen::operator& ( Screen && )
delete

◆ operator&() [2/2]

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

◆ pollActiveModifiers()

KeyModifierMask Screen::pollActiveModifiers ( ) const

Get the active modifiers from OS.

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

◆ reconfigure()

void Screen::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 screen are linked to clients.

◆ registerHotKey()

uint32_t Screen::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 Screen::resetOptions ( )

Notify of options changes.

Resets all options to their default values.

◆ screensaver()

void Screen::screensaver ( bool activate) const

Activate/deactivate screen saver.

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

◆ setClipboard()

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

Set clipboard.

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

◆ setOptions()

void Screen::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 Screen::setSequenceNumber ( uint32_t seqNum)

Set clipboard sequence number.

Sets the sequence number to use in subsequent clipboard events.

◆ unregisterHotKey()

void Screen::unregisterHotKey ( uint32_t id)

Unregister a system hotkey.

Unregisters a previously registered hot key.

◆ warpCursor()

void Screen::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: