mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-24 19:42:24 +03:00
"dir" was used by mistake instead of "filename"
This commit is contained in:
parent
8a8ae6c0b1
commit
3ee4f55a61
@ -26,7 +26,7 @@ CMSWindowsHookLibraryLoader::CMSWindowsHookLibraryLoader() :
|
||||
m_setSides(NULL),
|
||||
m_setZone(NULL),
|
||||
m_setMode(NULL),
|
||||
m_getDraggingFileDir(NULL)
|
||||
m_getDraggingFilename(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -91,9 +91,9 @@ CMSWindowsHookLibraryLoader::openShellLibrary(const char* name)
|
||||
}
|
||||
|
||||
// look up functions
|
||||
m_getDraggingFileDir = (GetDraggingFileDir)GetProcAddress(shellLibrary, "getDraggingFileDir");
|
||||
m_getDraggingFilename = (GetDraggingFilename)GetProcAddress(shellLibrary, "getDraggingFilename");
|
||||
|
||||
if (m_getDraggingFileDir == NULL) {
|
||||
if (m_getDraggingFilename == NULL) {
|
||||
LOG((CLOG_ERR "invalid shell library, use a newer %s.dll", name));
|
||||
throw XScreenOpenFailure();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
SetZoneFunc m_setZone;
|
||||
SetModeFunc m_setMode;
|
||||
|
||||
GetDraggingFileDir m_getDraggingFileDir;
|
||||
GetDraggingFilename m_getDraggingFilename;
|
||||
};
|
||||
|
||||
#endif
|
@ -362,8 +362,8 @@ CMSWindowsScreen::leave()
|
||||
forceShowCursor();
|
||||
|
||||
if (getDraggingStarted()) {
|
||||
CString& draggingDir = getDraggingFileDir();
|
||||
size_t size = draggingDir.size();
|
||||
CString& draggingFilename = getDraggingFilename();
|
||||
size_t size = draggingFilename.size();
|
||||
|
||||
if (!m_isPrimary) {
|
||||
// TODO: fake these keys properly
|
||||
@ -372,14 +372,14 @@ CMSWindowsScreen::leave()
|
||||
|
||||
fakeMouseButton(kButtonLeft, false);
|
||||
|
||||
if (draggingDir.empty() == false) {
|
||||
if (draggingFilename.empty() == false) {
|
||||
CClientApp& app = CClientApp::instance();
|
||||
CClient* client = app.getClientPtr();
|
||||
UInt32 fileCount = 1;
|
||||
LOG((CLOG_DEBUG "send dragging info to server: %s", draggingDir.c_str()));
|
||||
client->draggingInfoSending(fileCount, draggingDir, size);
|
||||
LOG((CLOG_DEBUG "send dragging info to server: %s", draggingFilename.c_str()));
|
||||
client->draggingInfoSending(fileCount, draggingFilename, size);
|
||||
LOG((CLOG_DEBUG "send dragging file to server"));
|
||||
client->sendFileToServer(draggingDir.c_str());
|
||||
client->sendFileToServer(draggingFilename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1332,8 +1332,8 @@ CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
|
||||
if (pressed) {
|
||||
m_buttons[button] = true;
|
||||
if (button == kButtonLeft) {
|
||||
m_draggingFileDir.clear();
|
||||
LOG((CLOG_DEBUG2 "dragging file directory is cleared"));
|
||||
m_draggingFilename.clear();
|
||||
LOG((CLOG_DEBUG2 "dragging filename is cleared"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1896,17 +1896,17 @@ CMSWindowsScreen::fakeDraggingFiles(CString str)
|
||||
}
|
||||
|
||||
CString&
|
||||
CMSWindowsScreen::getDraggingFileDir()
|
||||
CMSWindowsScreen::getDraggingFilename()
|
||||
{
|
||||
if (m_draggingStarted) {
|
||||
// temporarily log out dragging file directory
|
||||
// temporarily log out dragging filename
|
||||
char dir[MAX_PATH];
|
||||
m_hookLibraryLoader.m_getDraggingFileDir(dir);
|
||||
m_draggingFileDir.clear();
|
||||
m_draggingFileDir.append(dir);
|
||||
m_hookLibraryLoader.m_getDraggingFilename(dir);
|
||||
m_draggingFilename.clear();
|
||||
m_draggingFilename.append(dir);
|
||||
}
|
||||
|
||||
return m_draggingFileDir;
|
||||
return m_draggingFilename;
|
||||
}
|
||||
|
||||
const CString&
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
virtual void setSequenceNumber(UInt32);
|
||||
virtual bool isPrimary() const;
|
||||
virtual void fakeDraggingFiles(CString str);
|
||||
virtual CString& getDraggingFileDir();
|
||||
virtual CString& getDraggingFilename();
|
||||
virtual const CString&
|
||||
getDropTarget() const;
|
||||
|
||||
|
@ -912,7 +912,7 @@ COSXScreen::leave()
|
||||
hideCursor();
|
||||
|
||||
if (getDraggingStarted()) {
|
||||
CString& fileList = getDraggingFileDir();
|
||||
CString& fileList = getDraggingFilename();
|
||||
size_t size = fileList.size();
|
||||
|
||||
if (!m_isPrimary) {
|
||||
@ -1228,7 +1228,7 @@ COSXScreen::onMouseButton(bool pressed, UInt16 macButton)
|
||||
MouseButtonState state = pressed ? kMouseButtonDown : kMouseButtonUp;
|
||||
m_buttonState.set(kButtonLeft - 1, state);
|
||||
if (pressed) {
|
||||
m_draggingFileDir.clear();
|
||||
m_draggingFilename.clear();
|
||||
LOG((CLOG_DEBUG2 "dragging file directory is cleared"));
|
||||
}
|
||||
else {
|
||||
@ -2105,21 +2105,21 @@ COSXScreen::fakeDraggingFiles(CString str)
|
||||
}
|
||||
|
||||
CString&
|
||||
COSXScreen::getDraggingFileDir()
|
||||
COSXScreen::getDraggingFilename()
|
||||
{
|
||||
if (m_draggingStarted) {
|
||||
CFStringRef dragInfo = getDraggedFileURL();
|
||||
char* info = NULL;
|
||||
info = CFStringRefToUTF8String(dragInfo);
|
||||
if (info == NULL) {
|
||||
m_draggingFileDir.clear();
|
||||
m_draggingFilename.clear();
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "drag info: %s", info));
|
||||
CFRelease(dragInfo);
|
||||
CString fileList(info);
|
||||
m_draggingFileDir = fileList;
|
||||
m_draggingFilename = fileList;
|
||||
}
|
||||
}
|
||||
return m_draggingFileDir;
|
||||
return m_draggingFilename;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
virtual void setSequenceNumber(UInt32);
|
||||
virtual bool isPrimary() const;
|
||||
virtual void fakeDraggingFiles(CString str);
|
||||
virtual CString& getDraggingFileDir();
|
||||
virtual CString& getDraggingFilename();
|
||||
|
||||
const CString& getDropTarget() const { return m_dropTarget; }
|
||||
|
||||
|
@ -1669,7 +1669,7 @@ CServer::onMouseUp(ButtonID id)
|
||||
}
|
||||
|
||||
if (m_enableDragDrop && !m_screen->isOnScreen()) {
|
||||
CString& dir = m_screen->getDraggingFileDir();
|
||||
CString& dir = m_screen->getDraggingFilename();
|
||||
if (!dir.empty()) {
|
||||
LOG((CLOG_DEBUG "send file to client: %s", dir.c_str()));
|
||||
sendFileToClient(dir.c_str());
|
||||
@ -1750,7 +1750,7 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
|
||||
// should we switch or not?
|
||||
if (isSwitchOkay(newScreen, dir, x, y, xc, yc)) {
|
||||
if (m_enableDragDrop && m_screen->getDraggingStarted() && m_active != newScreen) {
|
||||
CString& dragFileList = m_screen->getDraggingFileDir();
|
||||
CString& dragFileList = m_screen->getDraggingFilename();
|
||||
size_t size = dragFileList.size() + 1;
|
||||
char* fileList = NULL;
|
||||
UInt32 fileCount = 1;
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
virtual void setDraggingStarted(bool started) { m_draggingStarted = started; }
|
||||
virtual bool getDraggingStarted();
|
||||
virtual bool getFakeDraggingStarted() { return m_fakeDraggingStarted; }
|
||||
virtual CString& getDraggingFileDir() { return m_draggingFileDir; }
|
||||
virtual CString& getDraggingFilename() { return m_draggingFilename; }
|
||||
|
||||
// IPlatformScreen overrides
|
||||
virtual void enable() = 0;
|
||||
@ -120,7 +120,7 @@ protected:
|
||||
virtual void handleSystemEvent(const CEvent& event, void*) = 0;
|
||||
|
||||
protected:
|
||||
CString m_draggingFileDir;
|
||||
CString m_draggingFilename;
|
||||
bool m_draggingStarted;
|
||||
bool m_fakeDraggingStarted;
|
||||
};
|
||||
|
@ -447,9 +447,9 @@ CScreen::setEnableDragDrop(bool enabled)
|
||||
}
|
||||
|
||||
CString&
|
||||
CScreen::getDraggingFileDir() const
|
||||
CScreen::getDraggingFilename() const
|
||||
{
|
||||
return m_screen->getDraggingFileDir();
|
||||
return m_screen->getDraggingFilename();
|
||||
}
|
||||
|
||||
const CString&
|
||||
|
@ -284,7 +284,7 @@ public:
|
||||
|
||||
//! Get dragging file's directory.
|
||||
|
||||
CString& getDraggingFileDir() const;
|
||||
CString& getDraggingFilename() const;
|
||||
|
||||
//! Get drop target directory.
|
||||
|
||||
|
@ -188,7 +188,7 @@ public:
|
||||
virtual SInt32 pollActiveGroup() const = 0;
|
||||
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const = 0;
|
||||
|
||||
virtual CString& getDraggingFileDir() = 0;
|
||||
virtual CString& getDraggingFilename() = 0;
|
||||
virtual bool getDraggingStarted() = 0;
|
||||
virtual bool getFakeDraggingStarted() = 0;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
extern LONG g_refCount;
|
||||
extern GUID g_CLSID;
|
||||
extern void updateDraggingDir(char*);
|
||||
extern void updateDraggingFilename(char*);
|
||||
extern void outputDebugStringF(const char *str, ...);
|
||||
|
||||
CDataHandlerExtension::CDataHandlerExtension() :
|
||||
@ -86,10 +86,10 @@ CDataHandlerExtension::Load(__RPC__in LPCOLESTR pszFileName, DWORD dwMode)
|
||||
{
|
||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::Load\n");
|
||||
|
||||
char selectedFileDir[MAX_PATH];
|
||||
StringCchCopyW(m_selectedFileDir, ARRAYSIZE(m_selectedFileDir), pszFileName);
|
||||
WideCharToMultiByte(CP_ACP, 0, m_selectedFileDir, -1, selectedFileDir, MAX_PATH, NULL, NULL);
|
||||
updateDraggingDir(selectedFileDir);
|
||||
char selectedFilename[MAX_PATH];
|
||||
StringCchCopyW(m_selectedFilename, ARRAYSIZE(m_selectedFilename), pszFileName);
|
||||
WideCharToMultiByte(CP_ACP, 0, m_selectedFilename, -1, selectedFilename, MAX_PATH, NULL, NULL);
|
||||
updateDraggingFilename(selectedFilename);
|
||||
|
||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::Load\n");
|
||||
return S_OK;
|
||||
|
@ -53,5 +53,5 @@ public:
|
||||
|
||||
private:
|
||||
LONG m_refCount;
|
||||
WCHAR m_selectedFileDir[MAX_PATH];
|
||||
WCHAR m_selectedFilename[MAX_PATH];
|
||||
};
|
||||
|
@ -28,7 +28,7 @@
|
||||
#pragma data_seg("sharedData")
|
||||
#endif
|
||||
|
||||
static BYTE g_draggingFileDir[MAX_PATH] = { 0 };
|
||||
static BYTE g_draggingFilename[MAX_PATH] = { 0 };
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma data_seg()
|
||||
@ -282,17 +282,17 @@ unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
||||
}
|
||||
|
||||
void
|
||||
updateDraggingDir(char* dir)
|
||||
updateDraggingFilename(char* filename)
|
||||
{
|
||||
outputDebugStringF("synwinxt: > updateDraggingDir, dir=%s\n", dir);
|
||||
memcpy(g_draggingFileDir, dir, MAX_PATH);
|
||||
outputDebugStringF("synwinxt: < updateDraggingDir, g_draggingFileDir=%s\n", g_draggingFileDir);
|
||||
outputDebugStringF("synwinxt: > updateDraggingFilename, filename=%s\n", filename);
|
||||
memcpy(g_draggingFilename, filename, MAX_PATH);
|
||||
outputDebugStringF("synwinxt: < updateDraggingFilename, g_draggingFilename=%s\n", g_draggingFilename);
|
||||
}
|
||||
|
||||
void
|
||||
getDraggingFileDir(char* dir)
|
||||
getDraggingFilename(char* filename)
|
||||
{
|
||||
outputDebugStringF("synwinxt: > getDraggingFileDir\n");
|
||||
memcpy(dir, g_draggingFileDir, MAX_PATH);
|
||||
outputDebugStringF("synwinxt: < getDraggingFileDir, dir=%s\n", dir);
|
||||
outputDebugStringF("synwinxt: > getDraggingFilename\n");
|
||||
memcpy(filename, g_draggingFilename, MAX_PATH);
|
||||
outputDebugStringF("synwinxt: < getDraggingFilename, filename=%s\n", filename);
|
||||
}
|
||||
|
@ -4,4 +4,4 @@ EXPORTS
|
||||
DllCanUnloadNow PRIVATE
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
getDraggingFileDir
|
||||
getDraggingFilename
|
||||
|
@ -25,6 +25,6 @@
|
||||
#define CSYNERGYSHELLEXE_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
typedef void (*GetDraggingFileDir)(CHAR*);
|
||||
typedef void (*GetDraggingFilename)(CHAR*);
|
||||
|
||||
CSYNERGYSHELLEXE_API void getDraggingFileDir(char*);
|
||||
CSYNERGYSHELLEXE_API void getDraggingFilename(char*);
|
||||
|
Loading…
Reference in New Issue
Block a user