CMSWindowsScreen Class Reference

Implementation of IPlatformScreen for Microsoft Windows. More...

#include <CMSWindowsScreen.h>

Inherits CPlatformScreen.

Collaboration diagram for CMSWindowsScreen:
Collaboration graph
[legend]

List of all members.

Classes

struct  CHotKeyItem

Public Member Functions

 CMSWindowsScreen (bool isPrimary)
virtual void * getEventTarget () const
 Get event target.
virtual bool getClipboard (ClipboardID id, IClipboard *) const
 Get clipboard.
virtual void getShape (SInt32 &x, SInt32 &y, SInt32 &width, SInt32 &height) const
 Get screen shape.
virtual void getCursorPos (SInt32 &x, SInt32 &y) const
 Get cursor position.
virtual void reconfigure (UInt32 activeSides)
 Update configuration.
virtual void warpCursor (SInt32 x, SInt32 y)
 Warp cursor.
virtual UInt32 registerHotKey (KeyID key, KeyModifierMask mask)
 Register a system hotkey.
virtual void unregisterHotKey (UInt32 id)
 Unregister a system hotkey.
virtual void fakeInputBegin ()
 Prepare to synthesize input on primary screen.
virtual void fakeInputEnd ()
 Done synthesizing input on primary screen.
virtual SInt32 getJumpZoneSize () const
 Get jump zone size.
virtual bool isAnyMouseButtonDown () const
 Test if mouse is pressed.
virtual void getCursorCenter (SInt32 &x, SInt32 &y) const
 Get cursor center position.
virtual void fakeMouseButton (ButtonID id, bool press) const
 Fake mouse press/release.
virtual void fakeMouseMove (SInt32 x, SInt32 y) const
 Fake mouse move.
virtual void fakeMouseRelativeMove (SInt32 dx, SInt32 dy) const
 Fake mouse move.
virtual void fakeMouseWheel (SInt32 xDelta, SInt32 yDelta) const
 Fake mouse wheel.
virtual void updateKeys ()
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 void enable ()
 Enable screen.
virtual void disable ()
 Disable screen.
virtual void enter ()
 Enter screen.
virtual bool leave ()
 Leave screen.
virtual bool setClipboard (ClipboardID, const IClipboard *)
 Set clipboard.
virtual void checkClipboards ()
 Check clipboard owner.
virtual void openScreensaver (bool notify)
 Open screen saver.
virtual void closeScreensaver ()
 Close screen saver.
virtual void screensaver (bool activate)
 Activate/deactivate screen saver.
virtual void resetOptions ()
 Notify of options changes.
virtual void setOptions (const COptionsList &options)
 Notify of options changes.
virtual void setSequenceNumber (UInt32)
 Set clipboard sequence number.
virtual bool isPrimary () const
 Test if is primary screen.

Static Public Member Functions

manipulators



static void init (HINSTANCE)
 Initialize.
accessors



static HINSTANCE getInstance ()
 Get instance.

Protected Member Functions

virtual void handleSystemEvent (const CEvent &, void *)
 Handle system event.
virtual void updateButtons ()
 Update mouse buttons.
virtual IKeyStategetKeyState () const
 Get the key state.

Detailed Description

Implementation of IPlatformScreen for Microsoft Windows.

Definition at line 33 of file CMSWindowsScreen.h.


Member Function Documentation

void CMSWindowsScreen::checkClipboards (  )  [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 CPlatformScreen.

Definition at line 343 of file CMSWindowsScreen.cpp.

References IScreen::getClipboardGrabbedEvent(), and CMSWindowsClipboard::isOwnedBySynergy().

void CMSWindowsScreen::closeScreensaver (  )  [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 CPlatformScreen.

Definition at line 379 of file CMSWindowsScreen.cpp.

References CMSWindowsScreenSaver::enable(), and CMSWindowsDesks::installScreensaverHooks().

void CMSWindowsScreen::disable (  )  [virtual]

Disable screen.

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

Implements CPlatformScreen.

Definition at line 217 of file CMSWindowsScreen.cpp.

References CMSWindowsKeyState::disable(), CMSWindowsDesks::disable(), CEvent::kTimer, and CArchMiscWindows::removeBusyState().

void CMSWindowsScreen::enable (  )  [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 CPlatformScreen.

Definition at line 185 of file CMSWindowsScreen.cpp.

References CArchMiscWindows::addBusyState(), CMSWindowsDesks::enable(), getJumpZoneSize(), and CEvent::kTimer.

void CMSWindowsScreen::enter (  )  [virtual]

Enter screen.

Called when the user navigates to this screen.

Implements CPlatformScreen.

Definition at line 254 of file CMSWindowsScreen.cpp.

References CMSWindowsScreenSaver::deactivate(), CMSWindowsDesks::enter(), and CArchMiscWindows::wakeupDisplay().

void CMSWindowsScreen::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.

Reimplemented from CPlatformScreen.

Definition at line 700 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::fakeInputBegin (  )  [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 CPlatformScreen.

Definition at line 590 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::fakeInputBegin(), and CMSWindowsKeyState::useSavedModifiers().

void CMSWindowsScreen::fakeInputEnd (  )  [virtual]

Done synthesizing input on primary screen.

Undoes whatever fakeInputBegin() did.

Implements CPlatformScreen.

Definition at line 601 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::fakeInputEnd(), and CMSWindowsKeyState::useSavedModifiers().

void CMSWindowsScreen::fakeKeyDown ( KeyID  id,
KeyModifierMask  mask,
KeyButton  button 
) [virtual]

Fake a key press.

Synthesizes a key press event and updates the key state.

Reimplemented from CPlatformScreen.

Definition at line 677 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::fakeKeyRepeat ( KeyID  id,
KeyModifierMask  mask,
SInt32  count,
KeyButton  button 
) [virtual]

Fake a key repeat.

Synthesizes a key repeat event and updates the key state.

Reimplemented from CPlatformScreen.

Definition at line 685 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::fakeKeyUp ( KeyButton  button  )  [virtual]

Fake a key release.

Synthesizes a key release event and updates the key state.

Reimplemented from CPlatformScreen.

Definition at line 693 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::fakeMouseButton ( ButtonID  id,
bool  press 
) const [virtual]

Fake mouse press/release.

Synthesize a press or release of mouse button id.

Implements CPlatformScreen.

Definition at line 647 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::fakeMouseButton().

void CMSWindowsScreen::fakeMouseMove ( SInt32  x,
SInt32  y 
) const [virtual]

Fake mouse move.

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

Implements CPlatformScreen.

Definition at line 653 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::fakeMouseMove().

void CMSWindowsScreen::fakeMouseRelativeMove ( SInt32  dx,
SInt32  dy 
) const [virtual]

Fake mouse move.

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

Implements CPlatformScreen.

Definition at line 659 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::fakeMouseRelativeMove().

void CMSWindowsScreen::fakeMouseWheel ( SInt32  xDelta,
SInt32  yDelta 
) const [virtual]

Fake mouse wheel.

Synthesize a mouse wheel event of amount xDelta and yDelta.

Implements CPlatformScreen.

Definition at line 665 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::fakeMouseWheel().

bool CMSWindowsScreen::getClipboard ( ClipboardID  id,
IClipboard  
) const [virtual]

Get clipboard.

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

Implements CPlatformScreen.

Definition at line 436 of file CMSWindowsScreen.cpp.

References IClipboard::copy().

void CMSWindowsScreen::getCursorCenter ( SInt32 &  x,
SInt32 &  y 
) const [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 CPlatformScreen.

Definition at line 640 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::getCursorPos ( SInt32 &  x,
SInt32 &  y 
) const [virtual]

Get cursor position.

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

Implements CPlatformScreen.

Definition at line 455 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::getCursorPos().

void * CMSWindowsScreen::getEventTarget (  )  const [virtual]

Get event target.

Returns the target used for events created by this object.

Implements CPlatformScreen.

Definition at line 430 of file CMSWindowsScreen.cpp.

HINSTANCE CMSWindowsScreen::getInstance (  )  [static]

Get instance.

Returns the application instance handle passed to init().

Definition at line 179 of file CMSWindowsScreen.cpp.

SInt32 CMSWindowsScreen::getJumpZoneSize (  )  const [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 CPlatformScreen.

Definition at line 612 of file CMSWindowsScreen.cpp.

Referenced by enable().

IKeyState * CMSWindowsScreen::getKeyState (  )  const [protected, virtual]

Get the key state.

Subclasses must implement this method to return the platform specific key state object that each subclass must have.

Implements CPlatformScreen.

Definition at line 874 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::getShape ( SInt32 &  x,
SInt32 &  y,
SInt32 &  width,
SInt32 &  height 
) const [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 CPlatformScreen.

Definition at line 444 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::handleSystemEvent ( const CEvent event,
void *   
) [protected, 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 CPlatformScreen.

Definition at line 844 of file CMSWindowsScreen.cpp.

References CArchMiscWindows::processDialog().

void CMSWindowsScreen::init ( HINSTANCE  instance  )  [static]

Initialize.

Saves the application's HINSTANCE. This must be called by WinMain with the HINSTANCE it was passed.

Definition at line 170 of file CMSWindowsScreen.cpp.

bool CMSWindowsScreen::isAnyMouseButtonDown (  )  const [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 CPlatformScreen.

Definition at line 618 of file CMSWindowsScreen.cpp.

bool CMSWindowsScreen::isPrimary (  )  const [virtual]

Test if is primary screen.

Return true iff this screen is a primary screen.

Implements CPlatformScreen.

Definition at line 424 of file CMSWindowsScreen.cpp.

bool CMSWindowsScreen::leave (  )  [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 CPlatformScreen.

Definition at line 284 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::leave(), CMSWindowsKeyState::saveModifiers(), CMSWindowsKeyState::setKeyLayout(), and warpCursor().

void CMSWindowsScreen::openScreensaver ( bool  notify  )  [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 CPlatformScreen.

Definition at line 365 of file CMSWindowsScreen.cpp.

References CMSWindowsScreenSaver::disable(), and CMSWindowsDesks::installScreensaverHooks().

void CMSWindowsScreen::reconfigure ( UInt32  activeSides  )  [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 CPlatformScreen.

Definition at line 461 of file CMSWindowsScreen.cpp.

UInt32 CMSWindowsScreen::registerHotKey ( KeyID  key,
KeyModifierMask  mask 
) [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 CPlatformScreen.

Definition at line 488 of file CMSWindowsScreen.cpp.

References CKeyMap::formatKey(), and CMSWindowsKeyState::mapKeyToVirtualKey().

void CMSWindowsScreen::resetOptions (  )  [virtual]

Notify of options changes.

Reset all options to their default values.

Implements CPlatformScreen.

Definition at line 406 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::resetOptions().

void CMSWindowsScreen::screensaver ( bool  activate  )  [virtual]

Activate/deactivate screen saver.

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

Implements CPlatformScreen.

Definition at line 393 of file CMSWindowsScreen.cpp.

References CMSWindowsScreenSaver::activate(), and CMSWindowsScreenSaver::deactivate().

bool CMSWindowsScreen::setClipboard ( ClipboardID  id,
const IClipboard  
) [virtual]

Set clipboard.

Set the contents of the system clipboard indicated by id.

Implements CPlatformScreen.

Definition at line 324 of file CMSWindowsScreen.cpp.

References CMSWindowsClipboard::close(), IClipboard::copy(), CMSWindowsClipboard::empty(), and CMSWindowsClipboard::open().

void CMSWindowsScreen::setOptions ( const COptionsList &  options  )  [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 CPlatformScreen.

Definition at line 412 of file CMSWindowsScreen.cpp.

References CMSWindowsDesks::setOptions().

void CMSWindowsScreen::setSequenceNumber ( UInt32   )  [virtual]

Set clipboard sequence number.

Sets the sequence number to use in subsequent clipboard events.

Implements CPlatformScreen.

Definition at line 418 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::unregisterHotKey ( UInt32  id  )  [virtual]

Unregister a system hotkey.

Unregisters a previously registered hot key.

Implements CPlatformScreen.

Definition at line 560 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::updateButtons (  )  [protected, virtual]

Update mouse buttons.

Subclasses must implement this method to update their internal mouse button mapping and, if desired, state tracking.

Implements CPlatformScreen.

Definition at line 860 of file CMSWindowsScreen.cpp.

void CMSWindowsScreen::warpCursor ( SInt32  x,
SInt32  y 
) [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 CPlatformScreen.

Definition at line 470 of file CMSWindowsScreen.cpp.

Referenced by leave().


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

Generated on 12 Nov 2010 for synergy-plus by  doxygen 1.6.1