Deskflow 1.22.0.197
Keyboard and mouse sharing utility
|
Microsoft Windows desk handling. More...
#include <MSWindowsDesks.h>
Public Member Functions | |
MSWindowsDesks (bool isPrimary, bool noHooks, const IScreenSaver *screensaver, IEventQueue *events, IJob *updateKeys) | |
Constructor. | |
~MSWindowsDesks () | |
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 OptionsList &options) |
Notify of options changes. | |
void | updateKeys () |
Update the key state. | |
void | setShape (int32_t x, int32_t y, int32_t width, int32_t height, int32_t xCenter, int32_t 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 (int32_t &x, int32_t &y) const |
Get cursor position. | |
void | fakeKeyEvent (WORD virtualKey, WORD scanCode, DWORD flags, bool isAutoRepeat) const |
Fake key press/release. | |
void | fakeMouseButton (ButtonID id, bool press) |
Fake mouse press/release. | |
void | fakeMouseMove (int32_t x, int32_t y) const |
Fake mouse move. | |
void | fakeMouseRelativeMove (int32_t dx, int32_t dy) const |
Fake mouse move. | |
void | fakeMouseWheel (int32_t xDelta, int32_t yDelta) const |
Fake mouse wheel. |
Microsoft Windows desk handling.
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. Deskflow must deal with them mainly because of the login window and screensaver but users can create their own desks and deskflow should work on those too.
This class encapsulates all the desk nastiness. Clients of this object don't have to know anything about desks.
MSWindowsDesks::MSWindowsDesks | ( | bool | isPrimary, |
bool | noHooks, | ||
const IScreenSaver * | screensaver, | ||
IEventQueue * | events, | ||
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.
MSWindowsDesks::~MSWindowsDesks | ( | ) |
void MSWindowsDesks::disable | ( | ) |
void MSWindowsDesks::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
.
void MSWindowsDesks::enter | ( | ) |
Notify of entering a desk.
Prepares a desk for when the cursor enters it.
void MSWindowsDesks::fakeInputBegin | ( | ) |
Start ignoring user input.
Starts ignoring user input so we don't pick up our own synthesized events.
void MSWindowsDesks::fakeInputEnd | ( | ) |
Stop ignoring user input.
Undoes whatever fakeInputBegin()
did.
void MSWindowsDesks::fakeKeyEvent | ( | WORD | virtualKey, |
WORD | scanCode, | ||
DWORD | flags, | ||
bool | isAutoRepeat ) const |
Fake key press/release.
Synthesize a press or release of key button
.
void MSWindowsDesks::fakeMouseButton | ( | ButtonID | id, |
bool | press ) |
Fake mouse press/release.
Synthesize a press or release of mouse button id
.
void MSWindowsDesks::fakeMouseMove | ( | int32_t | x, |
int32_t | y ) const |
Fake mouse move.
Synthesize a mouse move to the absolute coordinates x
,y.
void MSWindowsDesks::fakeMouseRelativeMove | ( | int32_t | dx, |
int32_t | dy ) const |
Fake mouse move.
Synthesize a mouse move to the relative coordinates dx
,dy.
void MSWindowsDesks::fakeMouseWheel | ( | int32_t | xDelta, |
int32_t | yDelta ) const |
Fake mouse wheel.
Synthesize a mouse wheel event of amount delta
in direction axis
.
void MSWindowsDesks::getCursorPos | ( | int32_t & | x, |
int32_t & | y ) const |
Get cursor position.
Return the current position of the cursor in x
and y
.
void MSWindowsDesks::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.
void MSWindowsDesks::leave | ( | HKL | keyLayout | ) |
Notify of leaving a desk.
Prepares a desk for when the cursor leaves it.
void MSWindowsDesks::resetOptions | ( | ) |
Notify of options changes.
Resets all options to their default values.
void MSWindowsDesks::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 MSWindowsDesks::setShape | ( | int32_t | x, |
int32_t | y, | ||
int32_t | width, | ||
int32_t | height, | ||
int32_t | xCenter, | ||
int32_t | yCenter, | ||
bool | isMultimon ) |
Tell desk about new size.
This tells the desks that the display size has changed.
void MSWindowsDesks::updateKeys | ( | ) |
Update the key state.
Causes the key state to get updated to reflect the physical keyboard state and current keyboard mapping.