Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IPlatformScreen Class Referenceabstract

Screen interface. More...

#include <IPlatformScreen.h>

Inheritance diagram for IPlatformScreen:
Collaboration diagram for IPlatformScreen:

Public Member Functions

manipulators
 IPlatformScreen (const IEventQueue *events)
virtual void enable ()=0
 Enable screen.
virtual void disable ()=0
 Disable screen.
virtual void enter ()=0
 Enter screen.
virtual bool canLeave ()=0
 Leave screen.
virtual void leave ()=0
 Leave screen.
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 IScreen
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.
Public Member Functions inherited from IPrimaryScreen
Public Member Functions inherited from ISecondaryScreen
Public Member Functions inherited from IKeyState
 IKeyState (const IEventQueue *events)

accessors

virtual bool isPrimary () const =0
 Test if is primary screen.
void * getEventTarget () const override=0
 Get event target.
bool getClipboard (ClipboardID id, IClipboard *) const override=0
 Get clipboard.
void getShape (int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override=0
 Get screen shape.
void getCursorPos (int32_t &x, int32_t &y) const override=0
 Get cursor position.
void reconfigure (uint32_t activeSides) override=0
 Update configuration.
uint32_t activeSides () override=0
 activeSides
void warpCursor (int32_t x, int32_t y) override=0
 Warp cursor.
uint32_t registerHotKey (KeyID key, KeyModifierMask mask) override=0
 Register a system hotkey.
void unregisterHotKey (uint32_t id) override=0
 Unregister a system hotkey.
void fakeInputBegin () override=0
 Prepare to synthesize input on primary screen.
void fakeInputEnd () override=0
 Done synthesizing input on primary screen.
int32_t getJumpZoneSize () const override=0
 Get jump zone size.
bool isAnyMouseButtonDown (uint32_t &buttonID) const override=0
 Test if mouse is pressed.
void getCursorCenter (int32_t &x, int32_t &y) const override=0
 Get cursor center position.
void fakeMouseButton (ButtonID id, bool press) override=0
 Fake mouse press/release.
void fakeMouseMove (int32_t x, int32_t y) override=0
 Fake mouse move.
void fakeMouseRelativeMove (int32_t dx, int32_t dy) const override=0
 Fake mouse move.
void fakeMouseWheel (int32_t xDelta, int32_t yDelta) const override=0
 Fake mouse wheel.
void updateKeyMap () override=0
 Update the keyboard map.
void updateKeyState () override=0
 Update the key state.
void setHalfDuplexMask (KeyModifierMask) override=0
 Set half-duplex mask.
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 fakeKeyUp (KeyButton button) override=0
 Fake a key release.
void fakeAllKeysUp () override=0
 Fake key releases for all fake pressed keys.
bool fakeCtrlAltDel () override=0
 Fake ctrl+alt+del.
bool fakeMediaKey (KeyID id) override
 Fake a media key.
bool isKeyDown (KeyButton) const override=0
 Test if key is pressed.
KeyModifierMask getActiveModifiers () const override=0
 Get the active modifiers.
KeyModifierMask pollActiveModifiers () const override=0
 Get the active modifiers from OS.
int32_t pollActiveGroup () const override=0
 Get the active keyboard layout from OS.
void pollPressedKeys (KeyButtonSet &pressedKeys) const override=0
 Get the keys currently pressed from OS.
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

Screen interface.

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

Constructor & Destructor Documentation

◆ IPlatformScreen()

IPlatformScreen::IPlatformScreen ( const IEventQueue * events)
inlineexplicit

Member Function Documentation

◆ activeSides()

uint32_t IPlatformScreen::activeSides ( )
overridepure virtual

activeSides

Returns
a bitmask of DirectionMask indicating which sides of the primary screen are linked to clients

Implements IPrimaryScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ canLeave()

virtual bool IPlatformScreen::canLeave ( )
pure virtual

Leave screen.

Called when the user navigates off the screen. 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 screen. Secondary screens should not fail.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ checkClipboards()

virtual void IPlatformScreen::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::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ closeScreensaver()

virtual void IPlatformScreen::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::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ disable()

virtual void IPlatformScreen::disable ( )
pure virtual

Disable screen.

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

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ enable()

virtual void IPlatformScreen::enable ( )
pure virtual

Enable screen.

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

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ enter()

virtual void IPlatformScreen::enter ( )
pure virtual

Enter screen.

Called when the user navigates to this screen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ fakeAllKeysUp()

void IPlatformScreen::fakeAllKeysUp ( )
overridepure 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.

Implemented in MSWindowsScreen, and PlatformScreen.

◆ fakeCtrlAltDel()

bool IPlatformScreen::fakeCtrlAltDel ( )
overridepure 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 PlatformScreen.

◆ fakeInputBegin()

void IPlatformScreen::fakeInputBegin ( )
overridepure virtual

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.

Implements IPrimaryScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ fakeInputEnd()

void IPlatformScreen::fakeInputEnd ( )
overridepure virtual

Done synthesizing input on primary screen.

Undoes whatever fakeInputBegin() did.

Implements IPrimaryScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ fakeKeyDown()

void IPlatformScreen::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 MSWindowsScreen, and PlatformScreen.

◆ fakeKeyRepeat()

bool IPlatformScreen::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 MSWindowsScreen, and PlatformScreen.

◆ fakeKeyUp()

bool IPlatformScreen::fakeKeyUp ( KeyButton button)
overridepure virtual

Fake a key release.

Synthesizes a key release event and updates the key state.

Implements IKeyState.

Implemented in MSWindowsScreen, and PlatformScreen.

◆ fakeMediaKey()

bool IPlatformScreen::fakeMediaKey ( KeyID id)
overridevirtual

Fake a media key.

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

Implements IKeyState.

◆ fakeMouseButton()

void IPlatformScreen::fakeMouseButton ( ButtonID id,
bool press )
overridepure virtual

Fake mouse press/release.

Synthesize a press or release of mouse button id.

Implements ISecondaryScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ fakeMouseMove()

void IPlatformScreen::fakeMouseMove ( int32_t x,
int32_t y )
overridepure virtual

Fake mouse move.

Synthesize a mouse move to the absolute coordinates x,y.

Implements ISecondaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ fakeMouseRelativeMove()

void IPlatformScreen::fakeMouseRelativeMove ( int32_t dx,
int32_t dy ) const
overridepure virtual

Fake mouse move.

Synthesize a mouse move to the relative coordinates dx,dy.

Implements ISecondaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ fakeMouseWheel()

void IPlatformScreen::fakeMouseWheel ( int32_t xDelta,
int32_t yDelta ) const
overridepure virtual

Fake mouse wheel.

Synthesize a mouse wheel event of amount xDelta and yDelta.

Implements ISecondaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ getActiveModifiers()

KeyModifierMask IPlatformScreen::getActiveModifiers ( ) const
overridepure virtual

Get the active modifiers.

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

Implements IKeyState.

Implemented in PlatformScreen.

◆ getClipboard()

bool IPlatformScreen::getClipboard ( ClipboardID id,
IClipboard *  ) const
overridepure virtual

Get clipboard.

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

Implements IScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ getCursorCenter()

void IPlatformScreen::getCursorCenter ( int32_t & x,
int32_t & y ) const
overridepure virtual

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.

Implements IPrimaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ getCursorPos()

void IPlatformScreen::getCursorPos ( int32_t & x,
int32_t & y ) const
overridepure virtual

Get cursor position.

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

Implements IScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ getEventTarget()

void * IPlatformScreen::getEventTarget ( ) const
overridepure virtual

Get event target.

Returns the target used for events created by this object.

Implements IScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ getJumpZoneSize()

int32_t IPlatformScreen::getJumpZoneSize ( ) const
overridepure virtual

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.

Implements IPrimaryScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ getSecureInputApp()

virtual std::string IPlatformScreen::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::EiScreen, MSWindowsScreen, OSXScreen, and XWindowsScreen.

◆ getShape()

void IPlatformScreen::getShape ( int32_t & x,
int32_t & y,
int32_t & width,
int32_t & height ) const
overridepure virtual

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.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ handleSystemEvent()

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

Handle system event.

A platform screen 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 IScreen as appropriate.

A primary screen has further responsibilities. It should post the events in IPrimaryScreen 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::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ isAnyMouseButtonDown()

bool IPlatformScreen::isAnyMouseButtonDown ( uint32_t & buttonID) const
overridepure virtual

Test if mouse is pressed.

Return true if any mouse button is currently pressed. Ideally, "current" means up to the last processed event but it can mean the current physical mouse button state.

Implements IPrimaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ isKeyDown()

bool IPlatformScreen::isKeyDown ( KeyButton ) const
overridepure virtual

Test if key is pressed.

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

Implements IKeyState.

Implemented in PlatformScreen.

◆ isPrimary()

virtual bool IPlatformScreen::isPrimary ( ) const
pure virtual

Test if is primary screen.

Return true iff this screen is a primary screen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ leave()

virtual void IPlatformScreen::leave ( )
pure virtual

Leave screen.

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

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ openScreensaver()

virtual void IPlatformScreen::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::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ pollActiveGroup()

int32_t IPlatformScreen::pollActiveGroup ( ) const
overridepure virtual

Get the active keyboard layout from OS.

Returns the active keyboard layout according to the operating system.

Implements IKeyState.

Implemented in PlatformScreen.

◆ pollActiveModifiers()

KeyModifierMask IPlatformScreen::pollActiveModifiers ( ) const
overridepure virtual

Get the active modifiers from OS.

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

Implements IKeyState.

Implemented in PlatformScreen.

◆ pollPressedKeys()

void IPlatformScreen::pollPressedKeys ( KeyButtonSet & pressedKeys) const
overridepure virtual

Get the keys currently pressed from OS.

Adds any keys that are currently pressed according to the operating system to pressedKeys.

Implements IKeyState.

Implemented in PlatformScreen.

◆ reconfigure()

void IPlatformScreen::reconfigure ( uint32_t activeSides)
overridepure virtual

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. Override to handle the possible change in jump zones.

Implements IPrimaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ registerHotKey()

uint32_t IPlatformScreen::registerHotKey ( KeyID key,
KeyModifierMask mask )
overridepure virtual

Register a system hotkey.

Registers a system-wide hotkey. The screen should arrange for an event to be delivered to itself when the hot key is pressed or released. When that happens the screen should post a getHotKeyDownEvent() or getHotKeyUpEvent(), respectively. The hot key is key key with exactly the modifiers mask. Returns 0 on failure otherwise an id that can be used to unregister the hotkey.

A hot key is a set of modifiers and a key, which may itself be a modifier. The hot key is pressed when the hot key's modifiers and only those modifiers are logically down (active) and the key is pressed. The hot key is released when the key is released, regardless of the modifiers.

The hot key event should be generated no matter what window or application has the focus. No other window or application should receive the key press or release events (they can and should see the modifier key events). When the key is a modifier, it's acceptable to allow the user to press the modifiers in any order or to require the user to press the given key last.

Implements IPrimaryScreen.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ resetOptions()

virtual void IPlatformScreen::resetOptions ( )
pure virtual

Notify of options changes.

Reset all options to their default values.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ screensaver()

virtual void IPlatformScreen::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::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ setClipboard()

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

Set clipboard.

Set the contents of the system clipboard indicated by id.

Implemented in deskflow::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ setHalfDuplexMask()

void IPlatformScreen::setHalfDuplexMask ( KeyModifierMask )
overridepure 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.

Implemented in PlatformScreen.

◆ setOptions()

virtual void IPlatformScreen::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::EiScreen, MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ setSequenceNumber()

virtual void IPlatformScreen::setSequenceNumber ( uint32_t )
pure virtual

Set clipboard sequence number.

Sets the sequence number to use in subsequent clipboard events.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ unregisterHotKey()

void IPlatformScreen::unregisterHotKey ( uint32_t id)
overridepure virtual

Unregister a system hotkey.

Unregisters a previously registered hot key.

Implements IPrimaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.

◆ updateKeyMap()

void IPlatformScreen::updateKeyMap ( )
overridepure virtual

Update the keyboard map.

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

Implements IKeyState.

Implemented in PlatformScreen.

◆ updateKeyState()

void IPlatformScreen::updateKeyState ( )
overridepure virtual

Update the key state.

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

Implements IKeyState.

Implemented in PlatformScreen.

◆ warpCursor()

void IPlatformScreen::warpCursor ( int32_t x,
int32_t y )
overridepure virtual

Warp cursor.

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

Implements IPrimaryScreen.

Implemented in MSWindowsScreen, OSXScreen, PlatformScreen, and XWindowsScreen.


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