#6344 Make client recognise clipboard size limit
This commit is contained in:
parent
01109e0499
commit
8af215364f
|
@ -44,6 +44,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Client
|
// Client
|
||||||
|
@ -73,7 +74,8 @@ Client::Client(
|
||||||
m_socket(NULL),
|
m_socket(NULL),
|
||||||
m_useSecureNetwork(args.m_enableCrypto),
|
m_useSecureNetwork(args.m_enableCrypto),
|
||||||
m_args(args),
|
m_args(args),
|
||||||
m_enableClipboard(true)
|
m_enableClipboard(true),
|
||||||
|
m_maximumClipboardSize(INT32_MAX)
|
||||||
{
|
{
|
||||||
assert(m_socketFactory != NULL);
|
assert(m_socketFactory != NULL);
|
||||||
assert(m_screen != NULL);
|
assert(m_screen != NULL);
|
||||||
|
@ -359,13 +361,24 @@ Client::setOptions(const OptionsList& options)
|
||||||
const OptionID id = *index;
|
const OptionID id = *index;
|
||||||
if (id == kOptionClipboardSharing) {
|
if (id == kOptionClipboardSharing) {
|
||||||
index++;
|
index++;
|
||||||
if (*index == static_cast<OptionValue>(false)) {
|
if (index != options.end()) {
|
||||||
|
if (*index) {
|
||||||
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
||||||
}
|
}
|
||||||
m_enableClipboard = *index;
|
m_enableClipboard = *index;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else if (id == kOptionClipboardSharingSize) {
|
||||||
|
index++;
|
||||||
|
if (index != options.end()) {
|
||||||
|
m_maximumClipboardSize = std::max(0u, *index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
m_screen->setOptions(options);
|
||||||
|
@ -656,7 +669,7 @@ Client::handleShapeChanged(const Event&, void*)
|
||||||
void
|
void
|
||||||
Client::handleClipboardGrabbed(const Event& event, void*)
|
Client::handleClipboardGrabbed(const Event& event, void*)
|
||||||
{
|
{
|
||||||
if (!m_enableClipboard) {
|
if (!m_enableClipboard || (m_maximumClipboardSize == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,4 +224,5 @@ private:
|
||||||
bool m_useSecureNetwork;
|
bool m_useSecureNetwork;
|
||||||
ClientArgs m_args;
|
ClientArgs m_args;
|
||||||
bool m_enableClipboard;
|
bool m_enableClipboard;
|
||||||
|
size_t m_maximumClipboardSize;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue