#include <CMSWindowsDesks.h>
Collaboration diagram for CMSWindowsDesks:
Public Member Functions | |
CMSWindowsDesks (bool isPrimary, HINSTANCE hookLibrary, const IScreenSaver *screensaver, IJob *updateKeys) | |
Constructor. | |
~CMSWindowsDesks () | |
manipulators | |
void | enable () |
Enable desk tracking. | |
void | disable () |
Disable desk tracking. | |
void | enter () |
Notify of entering a desk. | |
void | leave (HKL keyLayout) |
Notify of leaving a desk. | |
void | resetOptions () |
Notify of options changes. | |
void | setOptions (const COptionsList &options) |
Notify of options changes. | |
void | updateKeys () |
Update the key state. | |
void | setShape (SInt32 x, SInt32 y, SInt32 width, SInt32 height, SInt32 xCenter, SInt32 yCenter, bool isMultimon) |
Tell desk about new size. | |
void | installScreensaverHooks (bool install) |
Install/uninstall screensaver hooks. | |
void | fakeInputBegin () |
Start ignoring user input. | |
void | fakeInputEnd () |
Stop ignoring user input. | |
accessors | |
void | getCursorPos (SInt32 &x, SInt32 &y) const |
Get cursor position. | |
void | fakeKeyEvent (KeyButton button, UINT virtualKey, bool press, bool isAutoRepeat) const |
Fake key press/release. | |
void | fakeMouseButton (ButtonID id, bool press) const |
Fake mouse press/release. | |
void | fakeMouseMove (SInt32 x, SInt32 y) const |
Fake mouse move. | |
void | fakeMouseRelativeMove (SInt32 dx, SInt32 dy) const |
Fake mouse move. | |
void | fakeMouseWheel (SInt32 xDelta, SInt32 yDelta) const |
Fake mouse wheel. | |
Classes | |
class | CDesk |
Desks in Microsoft Windows are only remotely like desktops on X11 systems. A desk is another virtual surface for windows but desks impose serious restrictions: a thread can interact with only one desk at a time, you can't switch desks if the thread has any hooks installed or owns any windows, windows cannot exist on multiple desks at once, etc. Basically, they're useless except for running the login window or the screensaver, which is what they're used for. Synergy must deal with them mainly because of the login window and screensaver but users can create their own desks and synergy should work on those too.
This class encapsulates all the desk nastiness. Clients of this object don't have to know anything about desks.
Definition at line 51 of file CMSWindowsDesks.h.
CMSWindowsDesks::CMSWindowsDesks | ( | bool | isPrimary, | |
HINSTANCE | hookLibrary, | |||
const IScreenSaver * | screensaver, | |||
IJob * | updateKeys | |||
) |
Constructor.
isPrimary
is true iff the desk is for a primary screen. screensaver
points to a screensaver object and it's used only to check if the screensaver is active. The updateKeys
job is adopted and is called when the key state should be updated in a thread attached to the current desk. hookLibrary
must be a handle to the hook library.
Definition at line 88 of file CMSWindowsDesks.cpp.
References resetOptions().
void CMSWindowsDesks::disable | ( | ) |
Disable desk tracking.
Disables desk tracking.
Definition at line 144 of file CMSWindowsDesks.cpp.
References CEvent::kTimer.
Referenced by CMSWindowsScreen::disable(), and ~CMSWindowsDesks().
void CMSWindowsDesks::enable | ( | ) |
Enable desk tracking.
Enables desk tracking. While enabled, this object checks to see if the desk has changed and ensures that the hooks are installed on the new desk. setShape
should be called at least once before calling enable
.
Definition at line 124 of file CMSWindowsDesks.cpp.
References CEvent::kTimer, and updateKeys().
Referenced by CMSWindowsScreen::enable().
void CMSWindowsDesks::enter | ( | ) |
Notify of entering a desk.
Prepares a desk for when the cursor enters it.
Definition at line 160 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::enter().
void CMSWindowsDesks::fakeInputBegin | ( | ) |
Start ignoring user input.
Starts ignoring user input so we don't pick up our own synthesized events.
Definition at line 218 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::fakeInputBegin().
void CMSWindowsDesks::fakeInputEnd | ( | ) |
Stop ignoring user input.
Undoes whatever fakeInputBegin()
did.
Definition at line 224 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::fakeInputEnd().
void CMSWindowsDesks::fakeKeyEvent | ( | KeyButton | button, | |
UINT | virtualKey, | |||
bool | press, | |||
bool | isAutoRepeat | |||
) | const |
Fake key press/release.
Synthesize a press or release of key button
.
Definition at line 239 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsKeyState::fakeKey().
void CMSWindowsDesks::fakeMouseButton | ( | ButtonID | id, | |
bool | press | |||
) | const |
Fake mouse press/release.
Synthesize a press or release of mouse button id
.
Definition at line 277 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::fakeMouseButton().
void CMSWindowsDesks::fakeMouseMove | ( | SInt32 | x, | |
SInt32 | y | |||
) | const |
Fake mouse move.
Synthesize a mouse move to the absolute coordinates x
,y.
Definition at line 330 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::fakeMouseMove().
void CMSWindowsDesks::fakeMouseRelativeMove | ( | SInt32 | dx, | |
SInt32 | dy | |||
) | const |
Fake mouse move.
Synthesize a mouse move to the relative coordinates dx
,dy.
Definition at line 338 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::fakeMouseRelativeMove().
void CMSWindowsDesks::fakeMouseWheel | ( | SInt32 | xDelta, | |
SInt32 | yDelta | |||
) | const |
Fake mouse wheel.
Synthesize a mouse wheel event of amount delta
in direction axis
.
Definition at line 346 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::fakeMouseWheel().
void CMSWindowsDesks::getCursorPos | ( | SInt32 & | x, | |
SInt32 & | y | |||
) | const |
Get cursor position.
Return the current position of the cursor in x
and y
.
Definition at line 230 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::getCursorPos().
void CMSWindowsDesks::installScreensaverHooks | ( | bool | install | ) |
Install/uninstall screensaver hooks.
If install
is true then the screensaver hooks are installed and, if desk tracking is enabled, updated whenever the desk changes. If install
is false then the screensaver hooks are uninstalled.
Definition at line 209 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::closeScreensaver(), and CMSWindowsScreen::openScreensaver().
void CMSWindowsDesks::leave | ( | HKL | keyLayout | ) |
Notify of leaving a desk.
Prepares a desk for when the cursor leaves it.
Definition at line 166 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::leave().
void CMSWindowsDesks::resetOptions | ( | ) |
Notify of options changes.
Resets all options to their default values.
Definition at line 172 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsDesks(), and CMSWindowsScreen::resetOptions().
void CMSWindowsDesks::setOptions | ( | const COptionsList & | options | ) |
Notify of options changes.
Set options to given values. Ignores unknown options and doesn't modify options that aren't given in options
.
Definition at line 178 of file CMSWindowsDesks.cpp.
Referenced by CMSWindowsScreen::setOptions().
void CMSWindowsDesks::setShape | ( | SInt32 | x, | |
SInt32 | y, | |||
SInt32 | width, | |||
SInt32 | height, | |||
SInt32 | xCenter, | |||
SInt32 | yCenter, | |||
bool | isMultimon | |||
) |
Tell desk about new size.
This tells the desks that the display size has changed.
Definition at line 195 of file CMSWindowsDesks.cpp.
void CMSWindowsDesks::updateKeys | ( | ) |
Update the key state.
Causes the key state to get updated to reflect the physical keyboard state and current keyboard mapping.
Definition at line 189 of file CMSWindowsDesks.cpp.
Referenced by enable(), and CMSWindowsScreen::updateKeys().