Used MouseKeys accessibility function to show the mouse cursor

on a secondary screen when there's no physical mouse attached to
the system.  Kinda flaky when a mouse is attached or detached but
seems to work well enough when the device is not attached to start
with and not attached while running synergy.
This commit is contained in:
crs
2004-05-02 16:06:04 +00:00
parent 423dd3b718
commit a1bd77f91a
2 changed files with 134 additions and 1 deletions

View File

@@ -80,6 +80,12 @@ public:
// IKeyState overrides
virtual void updateKeys();
virtual void fakeKeyDown(KeyID id, KeyModifierMask mask,
KeyButton button);
virtual void fakeKeyRepeat(KeyID id, KeyModifierMask mask,
SInt32 count, KeyButton button);
virtual void fakeKeyUp(KeyButton button);
virtual void fakeToggle(KeyModifierMask modifier);
// IPlatformScreen overrides
virtual void enable();
@@ -174,6 +180,16 @@ private:
// job to update the key state
void updateKeysCB(void*);
// determine whether the mouse is hidden by the system and force
// it to be displayed if user has entered this secondary screen.
void forceShowCursor();
// forceShowCursor uses MouseKeys to show the cursor. since we
// don't actually want MouseKeys behavior we have to make sure
// it applies when NumLock is in whatever state it's not in now.
// this method does that.
void updateForceShowCursor();
// our window proc
static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
@@ -250,6 +266,23 @@ private:
IJob* m_suspend;
IJob* m_resume;
// the system shows the mouse cursor when an internal display count
// is >= 0. this count is maintained per application but there's
// apparently a system wide count added to the application's count.
// this system count is 0 if there's a mouse attached to the system
// and -1 otherwise. the MouseKeys accessibility feature can modify
// this system count by making the system appear to have a mouse.
//
// m_hasMouse is true iff there's a mouse attached to the system or
// MouseKeys is simulating one. we track this so we can force the
// cursor to be displayed when the user has entered this screen.
// m_showingMouse is true when we're doing that.
bool m_hasMouse;
bool m_showingMouse;
bool m_gotOldMouseKeys;
MOUSEKEYS m_mouseKeys;
MOUSEKEYS m_oldMouseKeys;
static CMSWindowsScreen* s_screen;
};