mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-23 09:43:24 +03:00
Sent clipboard on a thread #4601
This commit is contained in:
parent
49ac320f97
commit
cf5347c8f6
@ -79,7 +79,8 @@ Client::Client(
|
||||
m_writeToDropDirThread(NULL),
|
||||
m_socket(NULL),
|
||||
m_useSecureNetwork(false),
|
||||
m_args(args)
|
||||
m_args(args),
|
||||
m_sendClipboardThread(NULL)
|
||||
{
|
||||
assert(m_socketFactory != NULL);
|
||||
assert(m_screen != NULL);
|
||||
@ -265,12 +266,11 @@ Client::leave()
|
||||
|
||||
m_active = false;
|
||||
|
||||
// send clipboards that we own and that have changed
|
||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
|
||||
if (m_ownClipboard[id]) {
|
||||
sendClipboard(id);
|
||||
}
|
||||
}
|
||||
m_sendClipboardThread = new Thread(
|
||||
new TMethodJob<Client>(
|
||||
this,
|
||||
&Client::sendClipboardThread,
|
||||
NULL));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -750,6 +750,17 @@ Client::onFileRecieveCompleted()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Client::sendClipboardThread(void*)
|
||||
{
|
||||
// send clipboards that we own and that have changed
|
||||
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
|
||||
if (m_ownClipboard[id]) {
|
||||
sendClipboard(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Client::handleStopRetry(const Event&, void*)
|
||||
{
|
||||
|
@ -194,6 +194,7 @@ private:
|
||||
void handleFileRecieveCompleted(const Event&, void*);
|
||||
void handleStopRetry(const Event&, void*);
|
||||
void onFileRecieveCompleted();
|
||||
void sendClipboardThread(void*);
|
||||
|
||||
public:
|
||||
bool m_mock;
|
||||
@ -224,4 +225,5 @@ private:
|
||||
TCPSocket* m_socket;
|
||||
bool m_useSecureNetwork;
|
||||
ClientArgs& m_args;
|
||||
Thread* m_sendClipboardThread;
|
||||
};
|
||||
|
@ -92,7 +92,8 @@ Server::Server(
|
||||
m_ignoreFileTransfer(false),
|
||||
m_enableDragDrop(enableDragDrop),
|
||||
m_getDragInfoThread(NULL),
|
||||
m_waitDragInfoThread(true)
|
||||
m_waitDragInfoThread(true),
|
||||
m_sendClipboardThread(NULL)
|
||||
{
|
||||
// must have a primary client and it must have a canonical name
|
||||
assert(m_primaryClient != NULL);
|
||||
@ -505,6 +506,13 @@ Server::switchScreen(BaseClientProxy* dst,
|
||||
m_primaryClient->getToggleMask(),
|
||||
forScreensaver);
|
||||
|
||||
// send the clipboard data to new active screen
|
||||
m_sendClipboardThread = new Thread(
|
||||
new TMethodJob<Server>(
|
||||
this,
|
||||
&Server::sendClipboardThread,
|
||||
NULL));
|
||||
|
||||
Server::SwitchToScreenInfo* info =
|
||||
Server::SwitchToScreenInfo::alloc(m_active->getName());
|
||||
m_events->addEvent(Event(m_events->forServer().screenSwitched(), this, info));
|
||||
|
@ -484,5 +484,5 @@ private:
|
||||
|
||||
ClientListener* m_clientListener;
|
||||
|
||||
Thread* m_dataTransmissionThread;
|
||||
Thread* m_sendClipboardThread;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user