Base screen implementation. More...
#include <CPlatformScreen.h>
Inherits IPlatformScreen.
Inherited by CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
Public Member Functions | |
virtual void * | getEventTarget () const =0 |
Get event target. | |
virtual bool | getClipboard (ClipboardID id, IClipboard *) const =0 |
Get clipboard. | |
virtual void | getShape (SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const =0 |
Get screen shape. | |
virtual void | getCursorPos (SInt32 &x, SInt32 &y) const =0 |
Get cursor position. | |
virtual void | reconfigure (UInt32 activeSides)=0 |
Update configuration. | |
virtual void | warpCursor (SInt32 x, SInt32 y)=0 |
Warp cursor. | |
virtual UInt32 | registerHotKey (KeyID key, KeyModifierMask mask)=0 |
Register a system hotkey. | |
virtual void | unregisterHotKey (UInt32 id)=0 |
Unregister a system hotkey. | |
virtual void | fakeInputBegin ()=0 |
Prepare to synthesize input on primary screen. | |
virtual void | fakeInputEnd ()=0 |
Done synthesizing input on primary screen. | |
virtual SInt32 | getJumpZoneSize () const =0 |
Get jump zone size. | |
virtual bool | isAnyMouseButtonDown () const =0 |
Test if mouse is pressed. | |
virtual void | getCursorCenter (SInt32 &x, SInt32 &y) const =0 |
Get cursor center position. | |
virtual void | fakeMouseButton (ButtonID id, bool press) const =0 |
Fake mouse press/release. | |
virtual void | fakeMouseMove (SInt32 x, SInt32 y) const =0 |
Fake mouse move. | |
virtual void | fakeMouseRelativeMove (SInt32 dx, SInt32 dy) const =0 |
Fake mouse move. | |
virtual void | fakeMouseWheel (SInt32 xDelta, SInt32 yDelta) const =0 |
Fake mouse wheel. | |
virtual void | updateKeyMap () |
Update the keyboard map. | |
virtual void | updateKeyState () |
Update the key state. | |
virtual void | setHalfDuplexMask (KeyModifierMask) |
Set half-duplex mask. | |
virtual void | fakeKeyDown (KeyID id, KeyModifierMask mask, KeyButton button) |
Fake a key press. | |
virtual void | fakeKeyRepeat (KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) |
Fake a key repeat. | |
virtual void | fakeKeyUp (KeyButton button) |
Fake a key release. | |
virtual void | fakeAllKeysUp () |
Fake key releases for all fake pressed keys. | |
virtual bool | fakeCtrlAltDel () |
Fake ctrl+alt+del. | |
virtual bool | isKeyDown (KeyButton) const |
Test if key is pressed. | |
virtual KeyModifierMask | getActiveModifiers () const |
Get the active modifiers. | |
virtual KeyModifierMask | pollActiveModifiers () const |
Get the active modifiers from OS. | |
virtual SInt32 | pollActiveGroup () const |
Get the active keyboard layout from OS. | |
virtual void | pollPressedKeys (KeyButtonSet &pressedKeys) const |
Get the keys currently pressed from OS. | |
virtual void | enable ()=0 |
Enable screen. | |
virtual void | disable ()=0 |
Disable screen. | |
virtual void | enter ()=0 |
Enter screen. | |
virtual bool | leave ()=0 |
Leave screen. | |
virtual bool | setClipboard (ClipboardID, 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 COptionsList &options)=0 |
Notify of options changes. | |
virtual void | setSequenceNumber (UInt32)=0 |
Set clipboard sequence number. | |
virtual bool | isPrimary () const =0 |
Test if is primary screen. | |
Protected Member Functions | |
virtual void | updateButtons ()=0 |
Update mouse buttons. | |
virtual IKeyState * | getKeyState () const =0 |
Get the key state. | |
virtual void | handleSystemEvent (const CEvent &event, void *)=0 |
Handle system event. |
Base screen implementation.
This screen implementation is the superclass of all other screen implementations. It implements a handful of methods and requires subclasses to implement the rest.
Definition at line 26 of file CPlatformScreen.h.
virtual void CPlatformScreen::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.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::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.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::disable | ( | ) | [pure virtual] |
Disable screen.
Undoes the operations in enable() and events should no longer be reported.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::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.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::enter | ( | ) | [pure virtual] |
Enter screen.
Called when the user navigates to this screen.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
void CPlatformScreen::fakeAllKeysUp | ( | ) | [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 IPlatformScreen.
Reimplemented in CMSWindowsScreen.
Definition at line 67 of file CPlatformScreen.cpp.
References IKeyState::fakeAllKeysUp(), and getKeyState().
bool CPlatformScreen::fakeCtrlAltDel | ( | ) | [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 IPlatformScreen.
Definition at line 73 of file CPlatformScreen.cpp.
References IKeyState::fakeCtrlAltDel(), and getKeyState().
virtual void CPlatformScreen::fakeInputBegin | ( | ) | [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::fakeInputEnd | ( | ) | [pure virtual] |
Done synthesizing input on primary screen.
Undoes whatever fakeInputBegin()
did.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
void CPlatformScreen::fakeKeyDown | ( | KeyID | id, | |
KeyModifierMask | mask, | |||
KeyButton | button | |||
) | [virtual] |
Fake a key press.
Synthesizes a key press event and updates the key state.
Implements IPlatformScreen.
Reimplemented in CMSWindowsScreen.
Definition at line 47 of file CPlatformScreen.cpp.
References IKeyState::fakeKeyDown(), and getKeyState().
void CPlatformScreen::fakeKeyRepeat | ( | KeyID | id, | |
KeyModifierMask | mask, | |||
SInt32 | count, | |||
KeyButton | button | |||
) | [virtual] |
Fake a key repeat.
Synthesizes a key repeat event and updates the key state.
Implements IPlatformScreen.
Reimplemented in CMSWindowsScreen.
Definition at line 54 of file CPlatformScreen.cpp.
References IKeyState::fakeKeyRepeat(), and getKeyState().
void CPlatformScreen::fakeKeyUp | ( | KeyButton | button | ) | [virtual] |
Fake a key release.
Synthesizes a key release event and updates the key state.
Implements IPlatformScreen.
Reimplemented in CMSWindowsScreen.
Definition at line 61 of file CPlatformScreen.cpp.
References IKeyState::fakeKeyUp(), and getKeyState().
virtual void CPlatformScreen::fakeMouseButton | ( | ButtonID | id, | |
bool | press | |||
) | const [pure virtual] |
Fake mouse press/release.
Synthesize a press or release of mouse button id
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::fakeMouseMove | ( | SInt32 | x, | |
SInt32 | y | |||
) | const [pure virtual] |
Fake mouse move.
Synthesize a mouse move to the absolute coordinates x
,y.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::fakeMouseRelativeMove | ( | SInt32 | dx, | |
SInt32 | dy | |||
) | const [pure virtual] |
Fake mouse move.
Synthesize a mouse move to the relative coordinates dx
,dy.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::fakeMouseWheel | ( | SInt32 | xDelta, | |
SInt32 | yDelta | |||
) | const [pure virtual] |
Fake mouse wheel.
Synthesize a mouse wheel event of amount xDelta
and yDelta
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
KeyModifierMask CPlatformScreen::getActiveModifiers | ( | ) | const [virtual] |
Get the active modifiers.
Returns the modifiers that are currently active according to our shadowed state.
Implements IPlatformScreen.
Definition at line 85 of file CPlatformScreen.cpp.
References IKeyState::getActiveModifiers(), and getKeyState().
virtual bool CPlatformScreen::getClipboard | ( | ClipboardID | id, | |
IClipboard * | ||||
) | const [pure virtual] |
Get clipboard.
Save the contents of the clipboard indicated by id
and return true iff successful.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::getCursorCenter | ( | SInt32 & | x, | |
SInt32 & | y | |||
) | const [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::getCursorPos | ( | SInt32 & | x, | |
SInt32 & | y | |||
) | const [pure virtual] |
Get cursor position.
Return the current position of the cursor in x
and y
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void* CPlatformScreen::getEventTarget | ( | ) | const [pure virtual] |
Get event target.
Returns the target used for events created by this object.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual SInt32 CPlatformScreen::getJumpZoneSize | ( | ) | const [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual IKeyState* CPlatformScreen::getKeyState | ( | ) | const [protected, pure virtual] |
Get the key state.
Subclasses must implement this method to return the platform specific key state object that each subclass must have.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
Referenced by fakeAllKeysUp(), fakeCtrlAltDel(), fakeKeyDown(), fakeKeyRepeat(), fakeKeyUp(), getActiveModifiers(), isKeyDown(), pollActiveGroup(), pollActiveModifiers(), pollPressedKeys(), setHalfDuplexMask(), updateKeyMap(), and updateKeyState().
virtual void CPlatformScreen::getShape | ( | SInt32 & | x, | |
SInt32 & | y, | |||
SInt32 & | width, | |||
SInt32 & | height | |||
) | const [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::handleSystemEvent | ( | const CEvent & | event, | |
void * | ||||
) | [protected, pure virtual] |
Handle system event.
A platform screen is expected to install a handler for system events in its c'tor like so:
EVENTQUEUE->adoptHandler(CEvent::kSystem, IEventQueue::getSystemTarget(), new TMethodEventJob<CXXXPlatformScreen>(this, &CXXXPlatformScreen::handleSystemEvent));
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 CKeyState
whenever a key is pressed or released (but not for key repeats). And it should call updateKeyMap()
on its CKeyState
if necessary when the keyboard mapping changes.
The target of all events should be the value returned by getEventTarget()
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual bool CPlatformScreen::isAnyMouseButtonDown | ( | ) | const [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
bool CPlatformScreen::isKeyDown | ( | KeyButton | ) | const [virtual] |
Test if key is pressed.
Returns true iff the given key is down. Half-duplex toggles always return false.
Implements IPlatformScreen.
Definition at line 79 of file CPlatformScreen.cpp.
References getKeyState(), and IKeyState::isKeyDown().
virtual bool CPlatformScreen::isPrimary | ( | ) | const [pure virtual] |
Test if is primary screen.
Return true iff this screen is a primary screen.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual bool CPlatformScreen::leave | ( | ) | [pure virtual] |
Leave screen.
Called when the user navigates off the screen. Returns true on success, false on failure. A typical reason for failure is being unable to install the keyboard and mouse snoopers on a primary screen. Secondary screens should not fail.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::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()
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
SInt32 CPlatformScreen::pollActiveGroup | ( | ) | const [virtual] |
Get the active keyboard layout from OS.
Returns the active keyboard layout according to the operating system.
Implements IPlatformScreen.
Definition at line 97 of file CPlatformScreen.cpp.
References getKeyState(), and IKeyState::pollActiveGroup().
KeyModifierMask CPlatformScreen::pollActiveModifiers | ( | ) | const [virtual] |
Get the active modifiers from OS.
Returns the modifiers that are currently active according to the operating system.
Implements IPlatformScreen.
Definition at line 91 of file CPlatformScreen.cpp.
References getKeyState(), and IKeyState::pollActiveModifiers().
void CPlatformScreen::pollPressedKeys | ( | KeyButtonSet & | pressedKeys | ) | const [virtual] |
Get the keys currently pressed from OS.
Adds any keys that are currently pressed according to the operating system to pressedKeys
.
Implements IPlatformScreen.
Definition at line 103 of file CPlatformScreen.cpp.
References getKeyState(), and IKeyState::pollPressedKeys().
virtual void CPlatformScreen::reconfigure | ( | UInt32 | activeSides | ) | [pure virtual] |
Update configuration.
This is called when the configuration has changed. activeSides
is a bitmask of EDirectionMask indicating which sides of the primary screen are linked to clients. Override to handle the possible change in jump zones.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual UInt32 CPlatformScreen::registerHotKey | ( | KeyID | key, | |
KeyModifierMask | mask | |||
) | [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::resetOptions | ( | ) | [pure virtual] |
Notify of options changes.
Reset all options to their default values.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::screensaver | ( | bool | activate | ) | [pure virtual] |
Activate/deactivate screen saver.
Forcibly activate the screen saver if activate
is true otherwise forcibly deactivate it.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual bool CPlatformScreen::setClipboard | ( | ClipboardID | id, | |
const IClipboard * | ||||
) | [pure virtual] |
Set clipboard.
Set the contents of the system clipboard indicated by id
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
void CPlatformScreen::setHalfDuplexMask | ( | KeyModifierMask | ) | [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 IPlatformScreen.
Definition at line 41 of file CPlatformScreen.cpp.
References getKeyState(), and IKeyState::setHalfDuplexMask().
virtual void CPlatformScreen::setOptions | ( | const COptionsList & | 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
.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::setSequenceNumber | ( | UInt32 | ) | [pure virtual] |
Set clipboard sequence number.
Sets the sequence number to use in subsequent clipboard events.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::unregisterHotKey | ( | UInt32 | id | ) | [pure virtual] |
Unregister a system hotkey.
Unregisters a previously registered hot key.
Implements IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
virtual void CPlatformScreen::updateButtons | ( | ) | [protected, pure virtual] |
Update mouse buttons.
Subclasses must implement this method to update their internal mouse button mapping and, if desired, state tracking.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.
Referenced by updateKeyState().
void CPlatformScreen::updateKeyMap | ( | ) | [virtual] |
Update the keyboard map.
Causes the key state to get updated to reflect the current keyboard mapping.
Implements IPlatformScreen.
Definition at line 28 of file CPlatformScreen.cpp.
References getKeyState(), and IKeyState::updateKeyMap().
void CPlatformScreen::updateKeyState | ( | ) | [virtual] |
Update the key state.
Causes the key state to get updated to reflect the physical keyboard state.
Implements IPlatformScreen.
Definition at line 34 of file CPlatformScreen.cpp.
References getKeyState(), updateButtons(), and IKeyState::updateKeyState().
virtual void CPlatformScreen::warpCursor | ( | SInt32 | x, | |
SInt32 | y | |||
) | [pure 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 IPlatformScreen.
Implemented in CMSWindowsScreen, COSXScreen, and CXWindowsScreen.