#6344 Make client recognise clipboard size limit
This commit is contained in:
parent
01109e0499
commit
8af215364f
|
@ -44,6 +44,7 @@
|
|||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
//
|
||||
// Client
|
||||
|
@ -73,7 +74,8 @@ Client::Client(
|
|||
m_socket(NULL),
|
||||
m_useSecureNetwork(args.m_enableCrypto),
|
||||
m_args(args),
|
||||
m_enableClipboard(true)
|
||||
m_enableClipboard(true),
|
||||
m_maximumClipboardSize(INT32_MAX)
|
||||
{
|
||||
assert(m_socketFactory != NULL);
|
||||
assert(m_screen != NULL);
|
||||
|
@ -359,15 +361,26 @@ Client::setOptions(const OptionsList& options)
|
|||
const OptionID id = *index;
|
||||
if (id == kOptionClipboardSharing) {
|
||||
index++;
|
||||
if (*index == static_cast<OptionValue>(false)) {
|
||||
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
||||
if (index != options.end()) {
|
||||
if (*index) {
|
||||
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
||||
}
|
||||
m_enableClipboard = *index;
|
||||
}
|
||||
} else if (id == kOptionClipboardSharingSize) {
|
||||
index++;
|
||||
if (index != options.end()) {
|
||||
m_maximumClipboardSize = std::max(0u, *index);
|
||||
}
|
||||
m_enableClipboard = *index;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_enableClipboard && !m_maximumClipboardSize) {
|
||||
m_enableClipboard = false;
|
||||
LOG((CLOG_NOTE "clipboard sharing is disabled because the server "
|
||||
"set the maximum clipboard size to 0"));
|
||||
}
|
||||
|
||||
m_screen->setOptions(options);
|
||||
}
|
||||
|
||||
|
@ -656,7 +669,7 @@ Client::handleShapeChanged(const Event&, void*)
|
|||
void
|
||||
Client::handleClipboardGrabbed(const Event& event, void*)
|
||||
{
|
||||
if (!m_enableClipboard) {
|
||||
if (!m_enableClipboard || (m_maximumClipboardSize == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -198,11 +198,11 @@ public:
|
|||
bool m_mock;
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
NetworkAddress m_serverAddress;
|
||||
ISocketFactory* m_socketFactory;
|
||||
String m_name;
|
||||
NetworkAddress m_serverAddress;
|
||||
ISocketFactory* m_socketFactory;
|
||||
synergy::Screen* m_screen;
|
||||
synergy::IStream* m_stream;
|
||||
synergy::IStream* m_stream;
|
||||
EventQueueTimer* m_timer;
|
||||
ServerProxy* m_server;
|
||||
bool m_ready;
|
||||
|
@ -212,16 +212,17 @@ private:
|
|||
bool m_ownClipboard[kClipboardEnd];
|
||||
bool m_sentClipboard[kClipboardEnd];
|
||||
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
||||
String m_dataClipboard[kClipboardEnd];
|
||||
String m_dataClipboard[kClipboardEnd];
|
||||
IEventQueue* m_events;
|
||||
std::size_t m_expectedFileSize;
|
||||
String m_receivedFileData;
|
||||
std::size_t m_expectedFileSize;
|
||||
String m_receivedFileData;
|
||||
DragFileList m_dragFileList;
|
||||
String m_dragFileExt;
|
||||
Thread* m_sendFileThread;
|
||||
Thread* m_writeToDropDirThread;
|
||||
TCPSocket* m_socket;
|
||||
String m_dragFileExt;
|
||||
Thread* m_sendFileThread;
|
||||
Thread* m_writeToDropDirThread;
|
||||
TCPSocket* m_socket;
|
||||
bool m_useSecureNetwork;
|
||||
ClientArgs m_args;
|
||||
ClientArgs m_args;
|
||||
bool m_enableClipboard;
|
||||
size_t m_maximumClipboardSize;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue