18#define WIN32_LEAN_AND_MEAN
26class MSWindowsDropTarget;
43 static void init(HINSTANCE);
60 void getShape(int32_t &
x, int32_t &
y, int32_t &width, int32_t &height)
const override;
111 void enter()
override;
113 void leave()
override;
136 HCURSOR createBlankCursor()
const;
137 void destroyCursor(HCURSOR cursor)
const;
138 ATOM createWindowClass()
const;
139 ATOM createDeskWindowClass(
bool isPrimary)
const;
140 void destroyClass(ATOM windowClass)
const;
141 HWND createWindow(ATOM windowClass,
const wchar_t *
name)
const;
142 void destroyWindow(HWND)
const;
153 bool onPreDispatch(HWND, UINT, WPARAM, LPARAM);
157 bool onPreDispatchPrimary(HWND, UINT, WPARAM, LPARAM);
161 bool onPreDispatchSecondary(HWND, UINT, WPARAM, LPARAM);
165 bool onEvent(HWND, UINT, WPARAM, LPARAM, LRESULT *result);
168 bool onMark(uint32_t mark);
169 bool onKey(WPARAM, LPARAM);
170 bool onHotKey(WPARAM, LPARAM);
171 bool onMouseButton(WPARAM, LPARAM);
172 bool onMouseMove(int32_t
x, int32_t
y);
173 bool onMouseWheel(int32_t xDelta, int32_t yDelta);
174 bool onScreensaver(
bool activated);
175 bool onDisplayChange();
176 void onClipboardChange();
179 void warpCursorNoFlush(int32_t
x, int32_t
y);
188 void updateScreenShape();
194 void fixClipboardViewer();
197 void enableSpecialKeys(
bool)
const;
200 ButtonID mapButtonFromEvent(WPARAM msg, LPARAM button)
const;
203 bool mapPressFromEvent(WPARAM msg, LPARAM button)
const;
206 void updateKeysCB(
const void *);
214 void setupMouseKeys();
218 void updateMouseKeys();
221 static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
224 void saveMousePosition(int32_t
x, int32_t
y);
233 HotKeyItem(UINT vk, UINT modifiers);
235 UINT getVirtualKey()
const;
237 bool operator<(
const HotKeyItem &)
const;
243 using HotKeyMap = std::map<uint32_t, HotKeyItem>;
244 using HotKeyIDList = std::vector<uint32_t>;
245 using HotKeyToIDMap = std::map<HotKeyItem, uint32_t>;
246 using PrimaryKeyDownList = std::vector<KeyButton>;
248 static HINSTANCE s_windowInstance;
260 bool m_isEnabled =
false;
270 int32_t m_xCenter = 0;
271 int32_t m_yCenter = 0;
274 bool m_multimon =
false;
277 int32_t m_xCursor = 0;
278 int32_t m_yCursor = 0;
281 uint32_t m_sequenceNumber = 0;
285 uint32_t m_markReceived = 0;
294 HKL m_keyLayout =
nullptr;
298 bool m_screensaverNotify =
false;
299 bool m_screensaverActive =
false;
303 HWND m_window =
nullptr;
304 DWORD m_clipboardSequenceNumber = 0;
305 bool m_ownClipboard =
false;
315 HotKeyIDList m_oldHotKeyIDs;
316 HotKeyToIDMap m_hotKeyToIDMap;
326 bool m_gotMouseKeys =
false;
327 MOUSEKEYS m_mouseKeys;
335 std::string m_desktopPath;
337 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
Coordinate ScrollDelta
Definition Coordinate.h:21
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 uint8_t NumButtonIDs
Definition MouseTypes.h:37
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:704
MSWindowsScreen(bool isPrimary, bool useHooks, IEventQueue *events, bool enableLangSync=false)
Definition MSWindowsScreen.cpp:82
void unregisterHotKey(uint32_t id) override
Unregister a system hotkey.
Definition MSWindowsScreen.cpp:616
uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override
Register a system hotkey.
Definition MSWindowsScreen.cpp:539
static HINSTANCE getWindowInstance()
Get instance.
Definition MSWindowsScreen.cpp:168
void warpCursor(int32_t x, int32_t y) override
Warp cursor.
Definition MSWindowsScreen.cpp:516
bool canLeave() override
Leave screen.
Definition MSWindowsScreen.cpp:265
void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override
Get screen shape.
Definition MSWindowsScreen.cpp:426
void leave() override
Leave screen.
Definition MSWindowsScreen.cpp:278
void handleSystemEvent(const Event &event) override
Handle system event.
Definition MSWindowsScreen.cpp:834
void enter() override
Enter screen.
Definition MSWindowsScreen.cpp:235
void setSequenceNumber(uint32_t) override
Set clipboard sequence number.
Definition MSWindowsScreen.cpp:404
~MSWindowsScreen() override
Definition MSWindowsScreen.cpp:141
bool isAnyMouseButtonDown(uint32_t &buttonID) const override
Test if mouse is pressed.
Definition MSWindowsScreen.cpp:668
void enable() override
Enable screen.
Definition MSWindowsScreen.cpp:173
void fakeInputBegin() override
Prepare to synthesize input on primary screen.
Definition MSWindowsScreen.cpp:643
static void init(HINSTANCE)
Initialize.
Definition MSWindowsScreen.cpp:159
void * getEventTarget() const override
Get event target.
Definition MSWindowsScreen.cpp:414
bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override
Fake a key repeat.
Definition MSWindowsScreen.cpp:726
void updateButtons() override
Update mouse buttons.
Definition MSWindowsScreen.cpp:846
void getCursorPos(int32_t &x, int32_t &y) const override
Get cursor position.
Definition MSWindowsScreen.cpp:436
void sendEvent(EventTypes type, void *=nullptr)
Definition MSWindowsScreen.cpp:817
void closeScreensaver() override
Close screen saver.
Definition MSWindowsScreen.cpp:369
virtual void updateKeys()
Definition MSWindowsScreen.cpp:715
void screensaver(bool activate) override
Activate/deactivate screen saver.
Definition MSWindowsScreen.cpp:381
IKeyState * getKeyState() const override
Get the key state.
Definition MSWindowsScreen.cpp:857
void getCursorCenter(int32_t &x, int32_t &y) const override
Get cursor center position.
Definition MSWindowsScreen.cpp:684
void openScreensaver(bool notify) override
Open screen saver.
Definition MSWindowsScreen.cpp:357
void fakeMouseMove(int32_t x, int32_t y) override
Fake mouse move.
Definition MSWindowsScreen.cpp:699
bool setClipboard(ClipboardID, const IClipboard *) override
Set clipboard.
Definition MSWindowsScreen.cpp:319
void resetOptions() override
Notify of options changes.
Definition MSWindowsScreen.cpp:394
std::string getSecureInputApp() const override
Determine the name of the app causing a secure input state.
Definition MSWindowsScreen.cpp:1709
void fakeInputEnd() override
Done synthesizing input on primary screen.
Definition MSWindowsScreen.cpp:653
void setOptions(const OptionsList &options) override
Notify of options changes.
Definition MSWindowsScreen.cpp:399
void fakeMouseWheel(ScrollDelta delta) const override
Synthesize a mouse wheel event of amount This Implmentation for this method should call applyScrollMo...
Definition MSWindowsScreen.cpp:709
void fakeAllKeysUp() override
Fake key releases for all fake pressed keys.
Definition MSWindowsScreen.cpp:742
void checkClipboards() override
Check clipboard owner.
Definition MSWindowsScreen.cpp:336
virtual bool setThisCursorPos(int x, int y)
Sets the cursor position on the current machine.
Definition MSWindowsScreen.cpp:466
bool isPrimary() const override
Test if is primary screen.
Definition MSWindowsScreen.cpp:409
int32_t getJumpZoneSize() const override
Get jump zone size.
Definition MSWindowsScreen.cpp:663
void disable() override
Disable screen.
Definition MSWindowsScreen.cpp:201
virtual bool getThisCursorPos(LPPOINT pos)
Get the position of the cursor on the current machine.
Definition MSWindowsScreen.cpp:448
void fakeMouseButton(ButtonID id, bool press) override
Fake mouse press/release.
Definition MSWindowsScreen.cpp:690
bool getClipboard(ClipboardID id, IClipboard *) const override
Get clipboard.
Definition MSWindowsScreen.cpp:419
void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang) override
Fake a key press.
Definition MSWindowsScreen.cpp:720
void fakeLocalKey(KeyButton button, bool press) const
Definition MSWindowsScreen.cpp:1678
void reconfigure(uint32_t activeSides) override
Update configuration.
Definition MSWindowsScreen.cpp:503
bool fakeKeyUp(KeyButton button) override
Fake a key release.
Definition MSWindowsScreen.cpp:735
uint32_t activeSides() override
activeSides
Definition MSWindowsScreen.cpp:511
virtual void updateDesktopThread()
This function will attempt to switch to the current desktop the mouse is located on.
Definition MSWindowsScreen.cpp:484
Thread handle.
Definition Thread.h:33
EventTypes
Definition EventTypes.h:13