added null point handling for get dragging file directory.
This commit is contained in:
parent
952be51c8c
commit
10b9b2e406
|
@ -363,7 +363,6 @@ CMSWindowsScreen::leave()
|
||||||
|
|
||||||
if (getDraggingStarted()) {
|
if (getDraggingStarted()) {
|
||||||
CString& draggingDir = getDraggingFileDir();
|
CString& draggingDir = getDraggingFileDir();
|
||||||
LOG((CLOG_DEBUG "get dragging file dir: %s", draggingDir.c_str()));
|
|
||||||
size_t size = draggingDir.size();
|
size_t size = draggingDir.size();
|
||||||
|
|
||||||
if (!m_isPrimary) {
|
if (!m_isPrimary) {
|
||||||
|
@ -373,6 +372,7 @@ CMSWindowsScreen::leave()
|
||||||
|
|
||||||
fakeMouseButton(kButtonLeft, false);
|
fakeMouseButton(kButtonLeft, false);
|
||||||
|
|
||||||
|
if (draggingDir.empty() == false) {
|
||||||
CClientApp& app = CClientApp::instance();
|
CClientApp& app = CClientApp::instance();
|
||||||
CClient* client = app.getClientPtr();
|
CClient* client = app.getClientPtr();
|
||||||
UInt32 fileCount = 1;
|
UInt32 fileCount = 1;
|
||||||
|
@ -381,6 +381,7 @@ CMSWindowsScreen::leave()
|
||||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||||
client->sendFileToServer(draggingDir.c_str());
|
client->sendFileToServer(draggingDir.c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_draggingStarted = false;
|
m_draggingStarted = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -900,11 +900,7 @@ COSXScreen::leave()
|
||||||
hideCursor();
|
hideCursor();
|
||||||
|
|
||||||
if (getDraggingStarted()) {
|
if (getDraggingStarted()) {
|
||||||
CFStringRef dragInfo = getDraggedFileURL();
|
CString& fileList = getDraggingFileDir();
|
||||||
char* dragInfoCStr = CFStringRefToUTF8String(dragInfo);
|
|
||||||
LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));
|
|
||||||
CFRelease(dragInfo);
|
|
||||||
CString fileList(dragInfoCStr);
|
|
||||||
size_t size = fileList.size();
|
size_t size = fileList.size();
|
||||||
|
|
||||||
if (!m_isPrimary) {
|
if (!m_isPrimary) {
|
||||||
|
@ -916,12 +912,15 @@ COSXScreen::leave()
|
||||||
|
|
||||||
// fake ctrl key up
|
// fake ctrl key up
|
||||||
fakeKeyUp(29);
|
fakeKeyUp(29);
|
||||||
|
|
||||||
|
if (fileList.empty() == false) {
|
||||||
CClientApp& app = CClientApp::instance();
|
CClientApp& app = CClientApp::instance();
|
||||||
CClient* client = app.getClientPtr();
|
CClient* client = app.getClientPtr();
|
||||||
UInt32 fileCount = 1;
|
UInt32 fileCount = 1;
|
||||||
client->draggingInfoSending(fileCount, fileList, size);
|
client->draggingInfoSending(fileCount, fileList, size);
|
||||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||||
client->sendFileToServer(dragInfoCStr);
|
client->sendFileToServer(fileList.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_draggingStarted = false;
|
m_draggingStarted = false;
|
||||||
}
|
}
|
||||||
|
@ -2100,11 +2099,17 @@ COSXScreen::getDraggingFileDir()
|
||||||
{
|
{
|
||||||
if (m_draggingStarted) {
|
if (m_draggingStarted) {
|
||||||
CFStringRef dragInfo = getDraggedFileURL();
|
CFStringRef dragInfo = getDraggedFileURL();
|
||||||
char* info = CFStringRefToUTF8String(dragInfo);
|
char* info = NULL;
|
||||||
|
info = CFStringRefToUTF8String(dragInfo);
|
||||||
|
if (info == NULL) {
|
||||||
|
m_draggingFileDir.clear();
|
||||||
|
}
|
||||||
|
else {
|
||||||
LOG((CLOG_DEBUG "drag info: %s", info));
|
LOG((CLOG_DEBUG "drag info: %s", info));
|
||||||
CFRelease(dragInfo);
|
CFRelease(dragInfo);
|
||||||
CString fileList(info);
|
CString fileList(info);
|
||||||
m_draggingFileDir = fileList;
|
m_draggingFileDir = fileList;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return m_draggingFileDir;
|
return m_draggingFileDir;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1750,10 +1750,13 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
if (m_screen->getDraggingStarted() && m_active != newScreen) {
|
if (m_screen->getDraggingStarted() && m_active != newScreen) {
|
||||||
CString& dragFileList = m_screen->getDraggingFileDir();
|
CString& dragFileList = m_screen->getDraggingFileDir();
|
||||||
size_t size = dragFileList.size() + 1;
|
size_t size = dragFileList.size() + 1;
|
||||||
char* fileList = new char[size];
|
char* fileList = NULL;
|
||||||
|
UInt32 fileCount = 1;
|
||||||
|
if (dragFileList.empty() == false) {
|
||||||
|
fileList = new char[size];
|
||||||
memcpy(fileList, dragFileList.c_str(), size);
|
memcpy(fileList, dragFileList.c_str(), size);
|
||||||
fileList[size - 1] = '\0';
|
fileList[size - 1] = '\0';
|
||||||
UInt32 fileCount = 1;
|
}
|
||||||
|
|
||||||
// fake a escape key down and up then left mouse button up
|
// fake a escape key down and up then left mouse button up
|
||||||
m_screen->keyDown(kKeyEscape, 8192, 1);
|
m_screen->keyDown(kKeyEscape, 8192, 1);
|
||||||
|
@ -1769,11 +1772,12 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||||
m_ignoreFileTransfer = true;
|
m_ignoreFileTransfer = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (dragFileList.empty() == false) {
|
||||||
LOG((CLOG_DEBUG2 "sending drag information to client"));
|
LOG((CLOG_DEBUG2 "sending drag information to client"));
|
||||||
LOG((CLOG_DEBUG3 "dragging file list: %s", fileList));
|
LOG((CLOG_DEBUG3 "dragging file list: %s", fileList));
|
||||||
LOG((CLOG_DEBUG3 "dragging file list string size: %i", size));
|
LOG((CLOG_DEBUG3 "dragging file list string size: %i", size));
|
||||||
newScreen->draggingInfoSending(fileCount, fileList, size);
|
newScreen->draggingInfoSending(fileCount, fileList, size);
|
||||||
//m_screen->setDraggingStarted(false);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch screen
|
// switch screen
|
||||||
|
|
Loading…
Reference in New Issue