Deskflow
1.26.0.418
Keyboard and mouse sharing utility
Toggle main menu visibility
Loading...
Searching...
No Matches
ServerProxy.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 Synergy App 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
11
#include "
common/Enums.h
"
12
#include "
deskflow/ClipboardChunk.h
"
13
#include "
deskflow/ClipboardTypes.h
"
14
#include "
deskflow/KeyTypes.h
"
15
#include "
deskflow/KeyboardLayoutManager.h
"
16
17
class
Client
;
18
class
ClientInfo
;
19
class
EventQueueTimer
;
20
class
IClipboard
;
21
namespace
deskflow
{
22
class
IStream
;
23
}
24
class
IEventQueue
;
25
27
31
class
ServerProxy
32
{
33
public
:
38
ServerProxy
(
Client
*client,
deskflow::IStream
*stream,
IEventQueue
*events);
39
ServerProxy
(
ServerProxy
const
&) =
delete
;
40
ServerProxy
(
ServerProxy
&&) =
delete
;
41
~ServerProxy
();
42
43
ServerProxy
&
operator=
(
ServerProxy
const
&) =
delete
;
44
ServerProxy
&
operator=
(
ServerProxy
&&) =
delete
;
45
47
48
49
void
onInfoChanged
();
50
bool
onGrabClipboard
(
ClipboardID
);
51
void
onClipboardChanged
(
ClipboardID
,
const
IClipboard
*);
52
54
55
protected
:
56
enum class
ConnectionResult
57
{
58
Okay,
59
Unknown,
60
Disconnect
61
};
62
ConnectionResult
parseHandshakeMessage
(
const
uint8_t *code);
63
ConnectionResult
parseMessage
(
const
uint8_t *code);
64
65
private
:
66
// if compressing mouse motion then send the last motion now
67
void
flushCompressedMouse();
68
69
void
sendInfo(
const
ClientInfo
&);
70
71
void
resetKeepAliveAlarm();
72
void
setKeepAliveRate(
double
);
73
74
// modifier key translation
75
KeyID
translateKey(
KeyID
)
const
;
76
KeyModifierMask
translateModifierMask(
KeyModifierMask
)
const
;
77
78
// event handlers
79
void
handleData();
80
void
handleKeepAliveAlarm();
81
void
requestDisconnect(
const
char
*message);
82
void
requestRefuseConnection(
deskflow::core::ConnectionRefusal
reason,
const
char
*message);
83
84
// message handlers
85
void
enter();
86
void
leave();
87
void
setClipboard();
88
void
grabClipboard();
89
void
keyDown(uint16_t
id
, uint16_t mask, uint16_t button,
const
std::string &lang);
90
void
keyRepeat();
91
void
keyUp();
92
void
mouseDown();
93
void
mouseUp();
94
void
mouseMove();
95
void
mouseRelativeMove();
96
void
mouseWheel();
97
void
screensaver();
98
void
resetOptions();
99
void
setOptions();
100
void
queryInfo();
101
void
infoAcknowledgment();
102
void
secureInputNotification();
103
void
setServerLanguages();
104
void
setActiveServerLanguage(
const
std::string_view &language);
105
106
private
:
107
using
MessageParser =
ConnectionResult
(
ServerProxy
::*)(
const
uint8_t *);
108
109
Client
*m_client =
nullptr
;
110
deskflow::IStream
*m_stream =
nullptr
;
111
112
uint32_t m_seqNum = 0;
113
114
bool
m_compressMouse =
false
;
115
bool
m_compressMouseRelative =
false
;
116
int32_t m_xMouse = 0;
117
int32_t m_yMouse = 0;
118
int32_t m_dxMouse = 0;
119
int32_t m_dyMouse = 0;
120
121
bool
m_ignoreMouse =
false
;
122
123
KeyModifierID
m_modifierTranslationTable[kKeyModifierIDLast];
124
125
double
m_keepAliveAlarm = 0.0;
126
EventQueueTimer
*m_keepAliveAlarmTimer =
nullptr
;
127
128
MessageParser m_parser = &
ServerProxy::parseHandshakeMessage
;
129
IEventQueue
*m_events =
nullptr
;
130
std::string m_serverLayout =
""
;
131
std::string m_clipboardDataCached;
132
ClipboardChunkAssemblyState
m_clipboardChunkState;
133
bool
m_isUserNotifiedAboutLayoutSyncError =
false
;
134
deskflow::KeyboardLayoutManager
m_layoutManager;
135
};
ClipboardChunk.h
ClipboardTypes.h
ClipboardID
uint8_t ClipboardID
Clipboard ID.
Definition
ClipboardTypes.h:16
Enums.h
KeyTypes.h
KeyID
uint32_t KeyID
Key ID.
Definition
KeyTypes.h:21
KeyModifierID
uint32_t KeyModifierID
Modifier key ID.
Definition
KeyTypes.h:54
KeyModifierMask
uint32_t KeyModifierMask
Modifier key mask.
Definition
KeyTypes.h:44
KeyboardLayoutManager.h
ClientInfo
Client screen information structure.
Definition
ProtocolTypes.h:1304
Client
Deskflow client.
Definition
Client.h:42
EventQueueTimer
Definition
EventQueueTimer.h:12
IClipboard
Clipboard interface.
Definition
IClipboard.h:19
IEventQueue
Event queue interface.
Definition
IEventQueue.h:29
ServerProxy
Proxy for server.
Definition
ServerProxy.h:32
ServerProxy::parseMessage
ConnectionResult parseMessage(const uint8_t *code)
Definition
ServerProxy.cpp:208
ServerProxy::ConnectionResult
ConnectionResult
Definition
ServerProxy.h:57
ServerProxy::onClipboardChanged
void onClipboardChanged(ClipboardID, const IClipboard *)
Definition
ServerProxy.cpp:375
ServerProxy::ServerProxy
ServerProxy(ServerProxy const &)=delete
ServerProxy::ServerProxy
ServerProxy(ServerProxy &&)=delete
ServerProxy::onGrabClipboard
bool onGrabClipboard(ClipboardID)
Definition
ServerProxy.cpp:368
ServerProxy::ServerProxy
ServerProxy(Client *client, deskflow::IStream *stream, IEventQueue *events)
Definition
ServerProxy.cpp:30
ServerProxy::operator=
ServerProxy & operator=(ServerProxy const &)=delete
ServerProxy::operator=
ServerProxy & operator=(ServerProxy &&)=delete
ServerProxy::parseHandshakeMessage
ConnectionResult parseHandshakeMessage(const uint8_t *code)
Definition
ServerProxy.cpp:126
ServerProxy::onInfoChanged
void onInfoChanged()
Definition
ServerProxy.cpp:358
deskflow::IStream
Bidirectional stream interface.
Definition
IStream.h:22
deskflow::KeyboardLayoutManager
Definition
KeyboardLayoutManager.h:15
deskflow::core::ConnectionRefusal
ConnectionRefusal
Definition
Enums.h:48
deskflow
Definition
DaemonApp.h:18
ClipboardChunkAssemblyState
Definition
ClipboardChunk.h:23
src
lib
client
ServerProxy.h
Generated by
1.18.0