Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IPlatformScreen.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
4 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
5 * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
6 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7 */
8
9#pragma once
10
12#include "deskflow/IKeyState.h"
14#include "deskflow/IScreen.h"
17
18class IClipboard;
19
21
26class IPlatformScreen : public IScreen, public IPrimaryScreen, public ISecondaryScreen, public IKeyState
27{
28public:
30
31
32 explicit IPlatformScreen(const IEventQueue *events) : IKeyState(events)
33 {
34 // do nothing
35 }
36
38
43 virtual void enable() = 0;
44
46
50 virtual void disable() = 0;
51
53
56 virtual void enter() = 0;
57
59
65 virtual bool canLeave() = 0;
66
68
72 virtual void leave() = 0;
73
75
78 virtual bool setClipboard(ClipboardID id, const IClipboard *) = 0;
79
81
86 virtual void checkClipboards() = 0;
87
89
95 virtual void openScreensaver(bool notify) = 0;
96
98
103 virtual void closeScreensaver() = 0;
104
106
110 virtual void screensaver(bool activate) = 0;
111
113
116 virtual void resetOptions() = 0;
117
119
123 virtual void setOptions(const OptionsList &options) = 0;
124
126
129 virtual void setSequenceNumber(uint32_t) = 0;
130
132
136 virtual std::string getSecureInputApp() const = 0;
137
139
141
143
146 virtual bool isPrimary() const = 0;
147
149
150 // IScreen overrides
151 void *getEventTarget() const override = 0;
152 bool getClipboard(ClipboardID id, IClipboard *) const override = 0;
153 void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override = 0;
154 void getCursorPos(int32_t &x, int32_t &y) const override = 0;
155
156 // IPrimaryScreen overrides
157 void reconfigure(uint32_t activeSides) override = 0;
158 uint32_t activeSides() override = 0;
159 void warpCursor(int32_t x, int32_t y) override = 0;
160 uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override = 0;
161 void unregisterHotKey(uint32_t id) override = 0;
162 void fakeInputBegin() override = 0;
163 void fakeInputEnd() override = 0;
164 int32_t getJumpZoneSize() const override = 0;
165 bool isAnyMouseButtonDown(uint32_t &buttonID) const override = 0;
166 void getCursorCenter(int32_t &x, int32_t &y) const override = 0;
167
168 // ISecondaryScreen overrides
169 void fakeMouseButton(ButtonID id, bool press) override = 0;
170 void fakeMouseMove(int32_t x, int32_t y) override = 0;
171 void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override = 0;
172 void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override = 0;
173
174 // IKeyState overrides
175 void updateKeyMap() override = 0;
176 void updateKeyState() override = 0;
178 void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang) override = 0;
179 bool
180 fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override = 0;
181 bool fakeKeyUp(KeyButton button) override = 0;
182 void fakeAllKeysUp() override = 0;
183 bool fakeCtrlAltDel() override = 0;
184 bool fakeMediaKey(KeyID id) override;
185 bool isKeyDown(KeyButton) const override = 0;
188 int32_t pollActiveGroup() const override = 0;
189 void pollPressedKeys(KeyButtonSet &pressedKeys) const override = 0;
190
191protected:
193
215 virtual void handleSystemEvent(const Event &event) = 0;
216};
uint8_t ClipboardID
Clipboard ID.
Definition ClipboardTypes.h:16
int key
Definition KeySequence.cpp:15
uint32_t KeyID
Key ID.
Definition KeyTypes.h:22
uint16_t KeyButton
Key Code.
Definition KeyTypes.h:35
uint32_t KeyModifierMask
Modifier key mask.
Definition KeyTypes.h:45
uint8_t ButtonID
Mouse button ID.
Definition MouseTypes.h:16
std::vector< uint32_t > OptionsList
Definition OptionTypes.h:27
int y
Definition ServerConfig.cpp:27
int x
Definition ServerConfig.cpp:26
Event.
Definition Event.h:27
Clipboard interface.
Definition IClipboard.h:20
Event queue interface.
Definition IEventQueue.h:32
std::set< KeyButton > KeyButtonSet
Definition IKeyState.h:52
IKeyState(const IEventQueue *events)
Definition IKeyState.cpp:18
void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override=0
Get screen shape.
IPlatformScreen(const IEventQueue *events)
Definition IPlatformScreen.h:32
virtual bool setClipboard(ClipboardID id, const IClipboard *)=0
Set clipboard.
uint32_t activeSides() override=0
activeSides
bool getClipboard(ClipboardID id, IClipboard *) const override=0
Get clipboard.
bool fakeCtrlAltDel() override=0
Fake ctrl+alt+del.
void pollPressedKeys(KeyButtonSet &pressedKeys) const override=0
Get the keys currently pressed from OS.
virtual bool isPrimary() const =0
Test if is primary screen.
void unregisterHotKey(uint32_t id) override=0
Unregister a system hotkey.
bool isAnyMouseButtonDown(uint32_t &buttonID) const override=0
Test if mouse is pressed.
bool fakeMediaKey(KeyID id) override
Fake a media key.
Definition IPlatformScreen.cpp:9
virtual bool canLeave()=0
Leave screen.
void fakeAllKeysUp() override=0
Fake key releases for all fake pressed keys.
int32_t pollActiveGroup() const override=0
Get the active keyboard layout from OS.
void fakeInputBegin() override=0
Prepare to synthesize input on primary screen.
void fakeInputEnd() override=0
Done synthesizing input on primary screen.
uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override=0
Register a system hotkey.
virtual void handleSystemEvent(const Event &event)=0
Handle system event.
virtual void closeScreensaver()=0
Close screen saver.
bool fakeKeyUp(KeyButton button) override=0
Fake a key release.
void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override=0
Fake mouse move.
void warpCursor(int32_t x, int32_t y) override=0
Warp cursor.
void fakeMouseMove(int32_t x, int32_t y) override=0
Fake mouse move.
void setHalfDuplexMask(KeyModifierMask) override=0
Set half-duplex mask.
virtual void resetOptions()=0
Notify of options changes.
bool isKeyDown(KeyButton) const override=0
Test if key is pressed.
void fakeMouseButton(ButtonID id, bool press) override=0
Fake mouse press/release.
void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override=0
Fake mouse wheel.
KeyModifierMask getActiveModifiers() const override=0
Get the active modifiers.
void getCursorCenter(int32_t &x, int32_t &y) const override=0
Get cursor center position.
virtual void setSequenceNumber(uint32_t)=0
Set clipboard sequence number.
virtual void leave()=0
Leave screen.
void * getEventTarget() const override=0
Get event target.
void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang) override=0
Fake a key press.
bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override=0
Fake a key repeat.
virtual void openScreensaver(bool notify)=0
Open screen saver.
virtual void checkClipboards()=0
Check clipboard owner.
virtual void screensaver(bool activate)=0
Activate/deactivate screen saver.
virtual void setOptions(const OptionsList &options)=0
Notify of options changes.
virtual void enter()=0
Enter screen.
void reconfigure(uint32_t activeSides) override=0
Update configuration.
KeyModifierMask pollActiveModifiers() const override=0
Get the active modifiers from OS.
virtual std::string getSecureInputApp() const =0
Determine the name of the app causing a secure input state.
void updateKeyMap() override=0
Update the keyboard map.
virtual void enable()=0
Enable screen.
void getCursorPos(int32_t &x, int32_t &y) const override=0
Get cursor position.
int32_t getJumpZoneSize() const override=0
Get jump zone size.
void updateKeyState() override=0
Update the key state.
virtual void disable()=0
Disable screen.
Primary screen interface.
Definition IPrimaryScreen.h:22
Screen interface.
Definition IScreen.h:22
Secondary screen interface.
Definition ISecondaryScreen.h:21