Deskflow 1.22.0.197
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
10#include "deskflow/ClientArgs.h"
12
13#include <stdexcept>
14
16
22{
23public:
26 );
27 ~PlatformScreen() override = default;
28
29 // IScreen overrides
30 void *getEventTarget() const override = 0;
31 bool getClipboard(ClipboardID id, IClipboard *) const override = 0;
32 void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override = 0;
33 void getCursorPos(int32_t &x, int32_t &y) const override = 0;
34
35 // IPrimaryScreen overrides
36 void reconfigure(uint32_t activeSides) override = 0;
37 uint32_t activeSides() override = 0;
38 void warpCursor(int32_t x, int32_t y) override = 0;
39 uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override = 0;
40 void unregisterHotKey(uint32_t id) override = 0;
41 void fakeInputBegin() override = 0;
42 void fakeInputEnd() override = 0;
43 int32_t getJumpZoneSize() const override = 0;
44 bool isAnyMouseButtonDown(uint32_t &buttonID) const override = 0;
45 void getCursorCenter(int32_t &x, int32_t &y) const override = 0;
46
47 // ISecondaryScreen overrides
48 void fakeMouseButton(ButtonID id, bool press) override = 0;
49 void fakeMouseMove(int32_t x, int32_t y) override = 0;
50 void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override = 0;
51 void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override = 0;
52
53 // IKeyState overrides
54 void updateKeyMap() override;
55 void updateKeyState() override;
57 void fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &) override;
58 bool fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) override;
59 bool fakeKeyUp(KeyButton button) override;
60 void fakeAllKeysUp() override;
61 bool fakeCtrlAltDel() override;
62 bool isKeyDown(KeyButton) const override;
63 KeyModifierMask getActiveModifiers() const override;
64 KeyModifierMask pollActiveModifiers() const override;
65 int32_t pollActiveGroup() const override;
66 void pollPressedKeys(KeyButtonSet &pressedKeys) const override;
67
68 // IPlatformScreen overrides
69 void enable() override = 0;
70 void disable() override = 0;
71 void enter() override = 0;
72 bool canLeave() override = 0;
73 void leave() override = 0;
74 bool setClipboard(ClipboardID, const IClipboard *) override = 0;
75 void checkClipboards() override = 0;
76 void openScreensaver(bool notify) override = 0;
77 void closeScreensaver() override = 0;
78 void screensaver(bool activate) override = 0;
79 void resetOptions() override = 0;
80 void setOptions(const OptionsList &options) override = 0;
81 void setSequenceNumber(uint32_t) override = 0;
82 bool isPrimary() const override = 0;
83
84protected:
86
90 virtual void updateButtons() = 0;
91
93
97 virtual IKeyState *getKeyState() const = 0;
98
99 // IPlatformScreen overrides
100 void handleSystemEvent(const Event &event) override = 0;
101
107 virtual int32_t mapClientScrollDirection(int32_t) const;
108
109private:
116};
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
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.
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:87
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.
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, deskflow::ClientScrollDirection scrollDirection=deskflow::ClientScrollDirection::Normal)
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.
ClientScrollDirection
Definition ClientArgs.h:13
@ Normal
Same direction as the server.
Definition ClientArgs.h:14