Deskflow 1.24.0.365
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
PlatformScreen.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
4 * SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
5 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
6 */
7
8#pragma once
9
11
13
19{
20public:
21 explicit PlatformScreen(IEventQueue *events, bool invertScrollDirection);
22 ~PlatformScreen() override = default;
23
24 // IScreen overrides
25 void *getEventTarget() const override = 0;
26 bool getClipboard(ClipboardID id, IClipboard *) const override = 0;
27 void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override = 0;
28 void getCursorPos(int32_t &x, int32_t &y) const override = 0;
29
30 // IPrimaryScreen overrides
31 void reconfigure(uint32_t activeSides) override = 0;
32 uint32_t activeSides() override = 0;
33 void warpCursor(int32_t x, int32_t y) override = 0;
34 uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override = 0;
35 void unregisterHotKey(uint32_t id) override = 0;
36 void fakeInputBegin() override = 0;
37 void fakeInputEnd() override = 0;
38 int32_t getJumpZoneSize() const override = 0;
39 bool isAnyMouseButtonDown(uint32_t &buttonID) const override = 0;
40 void getCursorCenter(int32_t &x, int32_t &y) const override = 0;
41
42 // ISecondaryScreen overrides
43 void fakeMouseButton(ButtonID id, bool press) override = 0;
44 void fakeMouseMove(int32_t x, int32_t y) override = 0;
45 void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override = 0;
46 void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override = 0;
47
48 // IKeyState overrides
49 void updateKeyMap() override;
50 void updateKeyState() override;
52 void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &) override;
53 bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override;
54 bool fakeKeyUp(KeyButton button) override;
55 void fakeAllKeysUp() override;
56 bool fakeCtrlAltDel() override;
57 bool isKeyDown(KeyButton) const override;
58 KeyModifierMask getActiveModifiers() const override;
59 KeyModifierMask pollActiveModifiers() const override;
60 int32_t pollActiveGroup() const override;
61 void pollPressedKeys(KeyButtonSet &pressedKeys) const override;
62 void clearStaleModifiers() override;
63
64 // IPlatformScreen overrides
65 void enable() override = 0;
66 void disable() override = 0;
67 void enter() override = 0;
68 bool canLeave() override = 0;
69 void leave() override = 0;
70 bool setClipboard(ClipboardID, const IClipboard *) override = 0;
71 void checkClipboards() override = 0;
72 void openScreensaver(bool notify) override = 0;
73 void closeScreensaver() override = 0;
74 void screensaver(bool activate) override = 0;
75 void resetOptions() override = 0;
76 void setOptions(const OptionsList &options) override = 0;
77 void setSequenceNumber(uint32_t) override = 0;
78 bool isPrimary() const override = 0;
79
80protected:
82
86 virtual void updateButtons() = 0;
87
89
93 virtual IKeyState *getKeyState() const = 0;
94
95 // IPlatformScreen overrides
96 void handleSystemEvent(const Event &event) override = 0;
97
103 virtual int32_t mapClientScrollDirection(int32_t) const;
104
108 static std::string sidesMaskToString(uint32_t sides);
109
110private:
116 bool m_invertScrollDirection = false;
117};
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
std::vector< uint32_t > OptionsList
Definition OptionTypes.h:26
int y
Definition ServerConfig.cpp:25
int x
Definition ServerConfig.cpp:24
Event.
Definition Event.h:29
Clipboard interface.
Definition IClipboard.h:19
Event queue interface.
Definition IEventQueue.h:29
std::set< KeyButton > KeyButtonSet
Definition IKeyState.h:52
IKeyState(const IEventQueue *events)
Definition IKeyState.cpp:17
IPlatformScreen(const IEventQueue *events)
Definition IPlatformScreen.h:32
void fakeInputBegin() override=0
Prepare to synthesize input on primary screen.
void setSequenceNumber(uint32_t) override=0
Set clipboard sequence number.
bool getClipboard(ClipboardID id, IClipboard *) const override=0
Get clipboard.
bool isAnyMouseButtonDown(uint32_t &buttonID) const override=0
Test if mouse is pressed.
void updateKeyState() override
Update the key state.
Definition PlatformScreen.cpp:24
virtual IKeyState * getKeyState() const =0
Get the key state.
int32_t pollActiveGroup() const override
Get the active keyboard layout from OS.
Definition PlatformScreen.cpp:77
bool setClipboard(ClipboardID, const IClipboard *) override=0
Set clipboard.
void getCursorPos(int32_t &x, int32_t &y) const override=0
Get cursor position.
void screensaver(bool activate) override=0
Activate/deactivate screen saver.
void clearStaleModifiers() override
Clear stale modifiers.
Definition PlatformScreen.cpp:87
int32_t getJumpZoneSize() const override=0
Get jump zone size.
~PlatformScreen() override=default
void updateKeyMap() override
Update the keyboard map.
Definition PlatformScreen.cpp:19
virtual int32_t mapClientScrollDirection(int32_t) const
mapClientScrollDirection Convert scroll according to client scroll directio
Definition PlatformScreen.cpp:92
void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &) override
Fake a key press.
Definition PlatformScreen.cpp:35
void disable() override=0
Disable screen.
void checkClipboards() override=0
Check clipboard owner.
void resetOptions() override=0
Notify of options changes.
void warpCursor(int32_t x, int32_t y) override=0
Warp cursor.
void handleSystemEvent(const Event &event) override=0
Handle system event.
bool isPrimary() const override=0
Test if is primary screen.
void setHalfDuplexMask(KeyModifierMask) override
Set half-duplex mask.
Definition PlatformScreen.cpp:30
void enable() override=0
Enable screen.
void getCursorCenter(int32_t &x, int32_t &y) const override=0
Get cursor center position.
void fakeInputEnd() override=0
Done synthesizing input on primary screen.
void openScreensaver(bool notify) override=0
Open screen saver.
uint32_t activeSides() override=0
activeSides
void fakeMouseButton(ButtonID id, bool press) override=0
Fake mouse press/release.
void fakeMouseMove(int32_t x, int32_t y) override=0
Fake mouse move.
uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override=0
Register a system hotkey.
void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override=0
Fake mouse move.
void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override=0
Get screen shape.
void enter() override=0
Enter screen.
static std::string sidesMaskToString(uint32_t sides)
Definition PlatformScreen.cpp:97
virtual void updateButtons()=0
Update mouse buttons.
void * getEventTarget() const override=0
Get event target.
void unregisterHotKey(uint32_t id) override=0
Unregister a system hotkey.
PlatformScreen(IEventQueue *events, bool invertScrollDirection)
Definition PlatformScreen.cpp:12
bool fakeKeyUp(KeyButton button) override
Fake a key release.
Definition PlatformScreen.cpp:47
void fakeAllKeysUp() override
Fake key releases for all fake pressed keys.
Definition PlatformScreen.cpp:52
void closeScreensaver() override=0
Close screen saver.
void leave() override=0
Leave screen.
bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override
Fake a key repeat.
Definition PlatformScreen.cpp:40
void reconfigure(uint32_t activeSides) override=0
Update configuration.
void pollPressedKeys(KeyButtonSet &pressedKeys) const override
Get the keys currently pressed from OS.
Definition PlatformScreen.cpp:82
KeyModifierMask pollActiveModifiers() const override
Get the active modifiers from OS.
Definition PlatformScreen.cpp:72
bool isKeyDown(KeyButton) const override
Test if key is pressed.
Definition PlatformScreen.cpp:62
bool fakeCtrlAltDel() override
Fake ctrl+alt+del.
Definition PlatformScreen.cpp:57
KeyModifierMask getActiveModifiers() const override
Get the active modifiers.
Definition PlatformScreen.cpp:67
bool canLeave() override=0
Leave screen.
void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override=0
Fake mouse wheel.
void setOptions(const OptionsList &options) override=0
Notify of options changes.