Refactored send drag info on server #4584
This commit is contained in:
parent
ee22e688d5
commit
8c64cbf54e
|
@ -91,7 +91,7 @@ Server::Server(
|
||||||
m_writeToDropDirThread(NULL),
|
m_writeToDropDirThread(NULL),
|
||||||
m_ignoreFileTransfer(false),
|
m_ignoreFileTransfer(false),
|
||||||
m_enableDragDrop(enableDragDrop),
|
m_enableDragDrop(enableDragDrop),
|
||||||
m_getDragInfoThread(NULL),
|
m_sendDragInfoThread(NULL),
|
||||||
m_waitDragInfoThread(true),
|
m_waitDragInfoThread(true),
|
||||||
m_sendClipboardThread(NULL)
|
m_sendClipboardThread(NULL)
|
||||||
{
|
{
|
||||||
|
@ -1788,37 +1788,30 @@ Server::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
&& m_screen->isDraggingStarted()
|
&& m_screen->isDraggingStarted()
|
||||||
&& m_active != newScreen
|
&& m_active != newScreen
|
||||||
&& m_waitDragInfoThread) {
|
&& m_waitDragInfoThread) {
|
||||||
if (m_getDragInfoThread == NULL) {
|
if (m_sendDragInfoThread == NULL) {
|
||||||
m_getDragInfoThread = new Thread(
|
m_sendDragInfoThread = new Thread(
|
||||||
new TMethodJob<Server>(
|
new TMethodJob<Server>(
|
||||||
this,
|
this,
|
||||||
&Server::getDragInfoThread));
|
&Server::sendDragInfoThread, newScreen));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_getDragInfoThread == NULL) {
|
|
||||||
// switch screen
|
// switch screen
|
||||||
switchScreen(newScreen, x, y, false);
|
switchScreen(newScreen, x, y, false);
|
||||||
|
|
||||||
// send drag file info to client if there is any
|
|
||||||
if (m_dragFileList.size() > 0) {
|
|
||||||
sendDragInfo(newScreen);
|
|
||||||
m_dragFileList.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_waitDragInfoThread = true;
|
m_waitDragInfoThread = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Server::getDragInfoThread(void*)
|
Server::sendDragInfoThread(void* arg)
|
||||||
{
|
{
|
||||||
|
BaseClientProxy* newScreen = reinterpret_cast<BaseClientProxy*>(arg);
|
||||||
|
|
||||||
m_dragFileList.clear();
|
m_dragFileList.clear();
|
||||||
String& dragFileList = m_screen->getDraggingFilename();
|
String& dragFileList = m_screen->getDraggingFilename();
|
||||||
if (!dragFileList.empty()) {
|
if (!dragFileList.empty()) {
|
||||||
|
@ -1835,8 +1828,13 @@ Server::getDragInfoThread(void*)
|
||||||
m_ignoreFileTransfer = true;
|
m_ignoreFileTransfer = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// send drag file info to client if there is any
|
||||||
|
if (m_dragFileList.size() > 0) {
|
||||||
|
sendDragInfo(newScreen);
|
||||||
|
m_dragFileList.clear();
|
||||||
|
}
|
||||||
m_waitDragInfoThread = false;
|
m_waitDragInfoThread = false;
|
||||||
m_getDragInfoThread = NULL;
|
m_sendDragInfoThread = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -361,8 +361,8 @@ private:
|
||||||
// thread function for writing file to drop directory
|
// thread function for writing file to drop directory
|
||||||
void writeToDropDirThread(void*);
|
void writeToDropDirThread(void*);
|
||||||
|
|
||||||
// thread function for getting drag filename
|
// thread function for sending drag information
|
||||||
void getDragInfoThread(void*);
|
void sendDragInfoThread(void*);
|
||||||
|
|
||||||
// send drag info to new client screen
|
// send drag info to new client screen
|
||||||
void sendDragInfo(BaseClientProxy* newScreen);
|
void sendDragInfo(BaseClientProxy* newScreen);
|
||||||
|
@ -477,7 +477,7 @@ private:
|
||||||
bool m_ignoreFileTransfer;
|
bool m_ignoreFileTransfer;
|
||||||
bool m_enableDragDrop;
|
bool m_enableDragDrop;
|
||||||
|
|
||||||
Thread* m_getDragInfoThread;
|
Thread* m_sendDragInfoThread;
|
||||||
bool m_waitDragInfoThread;
|
bool m_waitDragInfoThread;
|
||||||
|
|
||||||
ClientListener* m_clientListener;
|
ClientListener* m_clientListener;
|
||||||
|
|
Loading…
Reference in New Issue