Deskflow 1.22.0.197
Keyboard and mouse sharing utility
|
Platform independent screen. More...
#include <Screen.h>
Public Member Functions | |
Screen (IPlatformScreen *platformScreen, IEventQueue *events) | |
Screen (Screen const &)=delete | |
Screen (Screen &&)=delete | |
~Screen () override | |
Screen & | operator& (Screen const &)=delete |
Screen & | operator& (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. | |
IPlatformScreen * | getPlatformScreen () |
void | enablePrimary () |
void | enableSecondary () |
void | disablePrimary () |
void | disableSecondary () |
void | enterPrimary () const |
void | enterSecondary (KeyModifierMask toggleMask) const |
void | leavePrimary () |
void | leaveSecondary () |
Platform independent screen.
This is a platform independent screen. It can work as either a primary or secondary screen.
Screen::Screen | ( | IPlatformScreen * | platformScreen, |
IEventQueue * | events ) |
|
delete |
|
delete |
|
override |
void Screen::disable | ( | ) |
Deactivate screen.
Undoes the operations in activate() and events are no longer reported. It also releases keys that are logically pressed.
|
protected |
|
protected |
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.
|
protected |
|
protected |
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.
|
protected |
|
protected |
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.
void Screen::fakeInputEnd | ( | ) |
Done synthesizing input on primary screen.
Undoes whatever fakeInputBegin()
did.
KeyModifierMask Screen::getActiveModifiers | ( | ) | const |
Get the active modifiers.
Returns the modifiers that are currently active according to our shadowed state.
|
overridevirtual |
Get clipboard.
Save the contents of the clipboard indicated by id
and return true iff successful.
Implements IScreen.
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.
|
overridevirtual |
|
overridevirtual |
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.
|
inline |
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
|
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.
void Screen::grabClipboard | ( | ClipboardID | id | ) |
Grab clipboard.
Grabs (i.e. take ownership of) the system clipboard.
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.
bool Screen::isOnScreen | ( | ) | const |
Test if cursor on screen.
Returns true iff the cursor is on the screen.
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().
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.
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.
bool Screen::leave | ( | ) |
Leave screen.
Called when the user navigates off this screen.
|
protected |
|
protected |
void Screen::mouseDown | ( | ButtonID | id | ) |
Notify of mouse press.
Synthesize mouse events to generate a press of mouse button id
.
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.
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.
void Screen::mouseUp | ( | ButtonID | id | ) |
Notify of mouse release.
Synthesize mouse events to generate a release of mouse button id
.
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.
KeyModifierMask Screen::pollActiveModifiers | ( | ) | const |
Get the active modifiers from OS.
Returns the modifiers that are currently active according to the operating system.
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.
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.
void Screen::resetOptions | ( | ) |
Notify of options changes.
Resets all options to their default values.
void Screen::screensaver | ( | bool | activate | ) | const |
Activate/deactivate screen saver.
Forcibly activates the screen saver if activate
is true otherwise forcibly deactivates it.
void Screen::setClipboard | ( | ClipboardID | id, |
const IClipboard * | clipboard ) |
Set clipboard.
Sets the system's clipboard contents. This is usually called soon after an enter().
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
.
void Screen::setSequenceNumber | ( | uint32_t | seqNum | ) |
Set clipboard sequence number.
Sets the sequence number to use in subsequent clipboard events.
void Screen::unregisterHotKey | ( | uint32_t | id | ) |
Unregister a system hotkey.
Unregisters a previously registered hot key.
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.