mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-11 06:05:08 +08:00
#6344 Make server recognise clipboard size limit
This commit is contained in:
committed by
Nick Bolton
parent
7e7760668a
commit
01109e0499
@@ -94,6 +94,7 @@ Server::Server(
|
||||
m_ignoreFileTransfer(false),
|
||||
m_disableLockToScreen(false),
|
||||
m_enableClipboard(true),
|
||||
m_maximumClipboardSize(INT32_MAX),
|
||||
m_sendDragInfoThread(NULL),
|
||||
m_waitDragInfoThread(true),
|
||||
m_args(args)
|
||||
@@ -1186,12 +1187,20 @@ Server::processOptions()
|
||||
m_disableLockToScreen = (value != 0);
|
||||
}
|
||||
else if (id == kOptionClipboardSharing) {
|
||||
m_enableClipboard = (value != 0);
|
||||
|
||||
if (m_enableClipboard == false) {
|
||||
m_enableClipboard = value;
|
||||
if (!m_enableClipboard) {
|
||||
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
||||
}
|
||||
}
|
||||
else if (id == kOptionClipboardSharingSize) {
|
||||
if (value <= 0) {
|
||||
m_maximumClipboardSize = 0;
|
||||
LOG((CLOG_NOTE "clipboard sharing is disabled because the "
|
||||
"maximum shared clipboard size is set to 0"));
|
||||
} else {
|
||||
m_maximumClipboardSize = static_cast<size_t>(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_relativeMoves && !newRelativeMoves) {
|
||||
stopRelativeMoves();
|
||||
@@ -1235,7 +1244,7 @@ Server::handleShapeChanged(const Event&, void* vclient)
|
||||
void
|
||||
Server::handleClipboardGrabbed(const Event& event, void* vclient)
|
||||
{
|
||||
if (!m_enableClipboard) {
|
||||
if (!m_enableClipboard || (m_maximumClipboardSize == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -475,6 +475,7 @@ private:
|
||||
bool m_ignoreFileTransfer;
|
||||
bool m_disableLockToScreen;
|
||||
bool m_enableClipboard;
|
||||
size_t m_maximumClipboardSize;
|
||||
|
||||
Thread* m_sendDragInfoThread;
|
||||
bool m_waitDragInfoThread;
|
||||
|
||||
Reference in New Issue
Block a user