18#define WIN32_LEAN_AND_MEAN
26class MSWindowsDropTarget;
33 bool isPrimary,
bool useHooks,
IEventQueue *events,
bool enableLangSync =
false,
bool invetScrolling =
false
45 static void init(HINSTANCE);
62 void getShape(int32_t &
x, int32_t &
y, int32_t &width, int32_t &height)
const override;
101 void fakeMouseWheel(int32_t xDelta, int32_t yDelta)
const override;
113 void enter()
override;
115 void leave()
override;
138 HCURSOR createBlankCursor()
const;
139 void destroyCursor(HCURSOR cursor)
const;
140 ATOM createWindowClass()
const;
141 ATOM createDeskWindowClass(
bool isPrimary)
const;
142 void destroyClass(ATOM windowClass)
const;
143 HWND createWindow(ATOM windowClass,
const wchar_t *
name)
const;
144 void destroyWindow(HWND)
const;
155 bool onPreDispatch(HWND, UINT, WPARAM, LPARAM);
159 bool onPreDispatchPrimary(HWND, UINT, WPARAM, LPARAM);
163 bool onPreDispatchSecondary(HWND, UINT, WPARAM, LPARAM);
167 bool onEvent(HWND, UINT, WPARAM, LPARAM, LRESULT *result);
170 bool onMark(uint32_t mark);
171 bool onKey(WPARAM, LPARAM);
172 bool onHotKey(WPARAM, LPARAM);
173 bool onMouseButton(WPARAM, LPARAM);
174 bool onMouseMove(int32_t
x, int32_t
y);
175 bool onMouseWheel(int32_t xDelta, int32_t yDelta);
176 bool onScreensaver(
bool activated);
177 bool onDisplayChange();
178 void onClipboardChange();
181 void warpCursorNoFlush(int32_t
x, int32_t
y);
190 void updateScreenShape();
196 void fixClipboardViewer();
199 void enableSpecialKeys(
bool)
const;
202 ButtonID mapButtonFromEvent(WPARAM msg, LPARAM button)
const;
205 bool mapPressFromEvent(WPARAM msg, LPARAM button)
const;
208 void updateKeysCB(
const void *);
216 void setupMouseKeys();
220 void updateMouseKeys();
223 static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
226 void saveMousePosition(int32_t
x, int32_t
y);
235 HotKeyItem(UINT vk, UINT modifiers);
237 UINT getVirtualKey()
const;
239 bool operator<(
const HotKeyItem &)
const;
245 using HotKeyMap = std::map<uint32_t, HotKeyItem>;
246 using HotKeyIDList = std::vector<uint32_t>;
247 using HotKeyToIDMap = std::map<HotKeyItem, uint32_t>;
248 using PrimaryKeyDownList = std::vector<KeyButton>;
250 static HINSTANCE s_windowInstance;
262 bool m_isEnabled =
false;
272 int32_t m_xCenter = 0;
273 int32_t m_yCenter = 0;
276 bool m_multimon =
false;
279 int32_t m_xCursor = 0;
280 int32_t m_yCursor = 0;
283 uint32_t m_sequenceNumber = 0;
287 uint32_t m_markReceived = 0;
296 HKL m_keyLayout =
nullptr;
300 bool m_screensaverNotify =
false;
301 bool m_screensaverActive =
false;
305 HWND m_window =
nullptr;
306 DWORD m_clipboardSequenceNumber = 0;
307 bool m_ownClipboard =
false;
317 HotKeyIDList m_oldHotKeyIDs;
318 HotKeyToIDMap m_hotKeyToIDMap;
328 bool m_gotMouseKeys =
false;
329 MOUSEKEYS m_mouseKeys;
337 std::string m_desktopPath;
339 PrimaryKeyDownList m_primaryKeyDownList;
static const struct sockaddr FAR * name
Definition ArchNetworkWinsock.cpp:28
static const WSAEVENT FAR DWORD
Definition ArchNetworkWinsock.cpp:55
static int type
Definition ArchNetworkWinsock.cpp:45
uint8_t ClipboardID
Clipboard ID.
Definition ClipboardTypes.h:16
int key
Definition KeySequence.cpp:15
uint32_t KeyID
Key ID.
Definition KeyTypes.h:21
uint16_t KeyButton
Key Code.
Definition KeyTypes.h:34
uint32_t KeyModifierMask
Modifier key mask.
Definition KeyTypes.h:44
uint8_t ButtonID
Mouse button ID.
Definition MouseTypes.h:16
static const ButtonID kButtonExtra0
Definition MouseTypes.h:24
std::vector< uint32_t > OptionsList
Definition OptionTypes.h:26
int y
Definition ServerConfig.cpp:25
int x
Definition ServerConfig.cpp:24
Definition EventQueueTimer.h:12
Event.
Definition Event.h:29
Clipboard interface.
Definition IClipboard.h:19
Event queue interface.
Definition IEventQueue.h:29
IKeyState(const IEventQueue *events)
Definition IKeyState.cpp:17
Microsoft Windows desk handling.
Definition MSWindowsDesks.h:46
Loads and provides functions for the Windows hook.
Definition MSWindowsHook.h:47
Microsoft Windows key mapper.
Definition MSWindowsKeyState.h:28
Definition MSWindowsPowerManager.h:11
Microsoft windows screen saver implementation.
Definition MSWindowsScreenSaver.h:19
void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override
Fake mouse move.
Definition MSWindowsScreen.cpp:706
void unregisterHotKey(uint32_t id) override
Unregister a system hotkey.
Definition MSWindowsScreen.cpp:618
uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override
Register a system hotkey.
Definition MSWindowsScreen.cpp:541
static HINSTANCE getWindowInstance()
Get instance.
Definition MSWindowsScreen.cpp:170
MSWindowsScreen(bool isPrimary, bool useHooks, IEventQueue *events, bool enableLangSync=false, bool invetScrolling=false)
Definition MSWindowsScreen.cpp:82
void warpCursor(int32_t x, int32_t y) override
Warp cursor.
Definition MSWindowsScreen.cpp:518
bool canLeave() override
Leave screen.
Definition MSWindowsScreen.cpp:267
void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override
Get screen shape.
Definition MSWindowsScreen.cpp:428
void leave() override
Leave screen.
Definition MSWindowsScreen.cpp:280
void handleSystemEvent(const Event &event) override
Handle system event.
Definition MSWindowsScreen.cpp:837
void enter() override
Enter screen.
Definition MSWindowsScreen.cpp:237
void setSequenceNumber(uint32_t) override
Set clipboard sequence number.
Definition MSWindowsScreen.cpp:406
~MSWindowsScreen() override
Definition MSWindowsScreen.cpp:143
bool isAnyMouseButtonDown(uint32_t &buttonID) const override
Test if mouse is pressed.
Definition MSWindowsScreen.cpp:670
void enable() override
Enable screen.
Definition MSWindowsScreen.cpp:175
void fakeInputBegin() override
Prepare to synthesize input on primary screen.
Definition MSWindowsScreen.cpp:645
static void init(HINSTANCE)
Initialize.
Definition MSWindowsScreen.cpp:161
void * getEventTarget() const override
Get event target.
Definition MSWindowsScreen.cpp:416
bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override
Fake a key repeat.
Definition MSWindowsScreen.cpp:729
void updateButtons() override
Update mouse buttons.
Definition MSWindowsScreen.cpp:849
void getCursorPos(int32_t &x, int32_t &y) const override
Get cursor position.
Definition MSWindowsScreen.cpp:438
void sendEvent(EventTypes type, void *=nullptr)
Definition MSWindowsScreen.cpp:820
void closeScreensaver() override
Close screen saver.
Definition MSWindowsScreen.cpp:371
virtual void updateKeys()
Definition MSWindowsScreen.cpp:718
void screensaver(bool activate) override
Activate/deactivate screen saver.
Definition MSWindowsScreen.cpp:383
IKeyState * getKeyState() const override
Get the key state.
Definition MSWindowsScreen.cpp:860
void getCursorCenter(int32_t &x, int32_t &y) const override
Get cursor center position.
Definition MSWindowsScreen.cpp:686
void openScreensaver(bool notify) override
Open screen saver.
Definition MSWindowsScreen.cpp:359
void fakeMouseMove(int32_t x, int32_t y) override
Fake mouse move.
Definition MSWindowsScreen.cpp:701
bool setClipboard(ClipboardID, const IClipboard *) override
Set clipboard.
Definition MSWindowsScreen.cpp:321
void resetOptions() override
Notify of options changes.
Definition MSWindowsScreen.cpp:396
std::string getSecureInputApp() const override
Determine the name of the app causing a secure input state.
Definition MSWindowsScreen.cpp:1712
void fakeInputEnd() override
Done synthesizing input on primary screen.
Definition MSWindowsScreen.cpp:655
void setOptions(const OptionsList &options) override
Notify of options changes.
Definition MSWindowsScreen.cpp:401
void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override
Fake mouse wheel.
Definition MSWindowsScreen.cpp:711
void fakeAllKeysUp() override
Fake key releases for all fake pressed keys.
Definition MSWindowsScreen.cpp:745
void checkClipboards() override
Check clipboard owner.
Definition MSWindowsScreen.cpp:338
virtual bool setThisCursorPos(int x, int y)
Sets the cursor position on the current machine.
Definition MSWindowsScreen.cpp:468
bool isPrimary() const override
Test if is primary screen.
Definition MSWindowsScreen.cpp:411
int32_t getJumpZoneSize() const override
Get jump zone size.
Definition MSWindowsScreen.cpp:665
void disable() override
Disable screen.
Definition MSWindowsScreen.cpp:203
virtual bool getThisCursorPos(LPPOINT pos)
Get the position of the cursor on the current machine.
Definition MSWindowsScreen.cpp:450
void fakeMouseButton(ButtonID id, bool press) override
Fake mouse press/release.
Definition MSWindowsScreen.cpp:692
bool getClipboard(ClipboardID id, IClipboard *) const override
Get clipboard.
Definition MSWindowsScreen.cpp:421
void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang) override
Fake a key press.
Definition MSWindowsScreen.cpp:723
void fakeLocalKey(KeyButton button, bool press) const
Definition MSWindowsScreen.cpp:1681
void reconfigure(uint32_t activeSides) override
Update configuration.
Definition MSWindowsScreen.cpp:505
bool fakeKeyUp(KeyButton button) override
Fake a key release.
Definition MSWindowsScreen.cpp:738
uint32_t activeSides() override
activeSides
Definition MSWindowsScreen.cpp:513
virtual void updateDesktopThread()
This function will attempt to switch to the current desktop the mouse is located on.
Definition MSWindowsScreen.cpp:486
Thread handle.
Definition Thread.h:33
EventTypes
Definition EventTypes.h:13