mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-30 15:56:00 +08:00
Task #3951 - Clear filename stored in synwinxt on mouse up
- renamed some functions for file drag/drop to be more similar to existing - improved log messages for the library loader - removed hack that blocked .exe and .lnk files (annoying for developers) - removed hack that always clears dragging filename (not very robust)
This commit is contained in:
@@ -27,7 +27,8 @@ CMSWindowsHookLibraryLoader::CMSWindowsHookLibraryLoader() :
|
||||
m_setSides(NULL),
|
||||
m_setZone(NULL),
|
||||
m_setMode(NULL),
|
||||
m_getDraggingFilename(NULL)
|
||||
m_getDraggingFilename(NULL),
|
||||
m_clearDraggingFilename(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -52,13 +53,14 @@ CMSWindowsHookLibraryLoader::openHookLibrary(const char* name)
|
||||
m_setMode = (SetModeFunc)GetProcAddress(hookLibrary, "setMode");
|
||||
m_init = (InitFunc)GetProcAddress(hookLibrary, "init");
|
||||
m_cleanup = (CleanupFunc)GetProcAddress(hookLibrary, "cleanup");
|
||||
if (m_setSides == NULL ||
|
||||
m_setZone == NULL ||
|
||||
m_setMode == NULL ||
|
||||
m_init == NULL ||
|
||||
m_cleanup == NULL) {
|
||||
LOG((CLOG_ERR "invalid hook library, use a newer %s.dll", name));
|
||||
throw XScreenOpenFailure();
|
||||
|
||||
if (m_setSides == NULL ||
|
||||
m_setZone == NULL ||
|
||||
m_setMode == NULL ||
|
||||
m_init == NULL ||
|
||||
m_cleanup == NULL) {
|
||||
LOG((CLOG_ERR "failed to load hook function, %s.dll could be out of date", name));
|
||||
throw XScreenOpenFailure();
|
||||
}
|
||||
|
||||
// initialize hook library
|
||||
@@ -80,22 +82,24 @@ CMSWindowsHookLibraryLoader::openShellLibrary(const char* name)
|
||||
GetVersionEx(&osvi);
|
||||
|
||||
if (osvi.dwMajorVersion < 6) {
|
||||
LOG((CLOG_INFO "skipping shell library load, %s.dll not supported before vista", name));
|
||||
LOG((CLOG_INFO "skipping shell extension library load, %s.dll not supported before vista", name));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// load the hook library
|
||||
HINSTANCE shellLibrary = LoadLibrary(name);
|
||||
if (shellLibrary == NULL) {
|
||||
LOG((CLOG_ERR "failed to load shell library, %s.dll is missing or invalid", name));
|
||||
LOG((CLOG_ERR "failed to load shell extension library, %s.dll is missing or invalid", name));
|
||||
throw XScreenOpenFailure();
|
||||
}
|
||||
|
||||
// look up functions
|
||||
m_getDraggingFilename = (GetDraggingFilename)GetProcAddress(shellLibrary, "getDraggingFilename");
|
||||
m_getDraggingFilename = (GetDraggingFilenameFunc)GetProcAddress(shellLibrary, "getDraggingFilename");
|
||||
m_clearDraggingFilename = (ClearDraggingFilenameFunc)GetProcAddress(shellLibrary, "clearDraggingFilename");
|
||||
|
||||
if (m_getDraggingFilename == NULL) {
|
||||
LOG((CLOG_ERR "invalid shell library, use a newer %s.dll", name));
|
||||
if (m_getDraggingFilename == NULL ||
|
||||
m_clearDraggingFilename == NULL) {
|
||||
LOG((CLOG_ERR "failed to load shell extension function, %s.dll could be out of date", name));
|
||||
throw XScreenOpenFailure();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ public:
|
||||
SetSidesFunc m_setSides;
|
||||
SetZoneFunc m_setZone;
|
||||
SetModeFunc m_setMode;
|
||||
|
||||
GetDraggingFilename m_getDraggingFilename;
|
||||
|
||||
GetDraggingFilenameFunc
|
||||
m_getDraggingFilename;
|
||||
ClearDraggingFilenameFunc
|
||||
m_clearDraggingFilename;
|
||||
};
|
||||
|
||||
@@ -369,7 +369,7 @@ CMSWindowsScreen::leave()
|
||||
m_isOnScreen = false;
|
||||
forceShowCursor();
|
||||
|
||||
if (getDraggingStarted()) {
|
||||
if (isDraggingStarted()) {
|
||||
CString& draggingFilename = getDraggingFilename();
|
||||
size_t size = draggingFilename.size();
|
||||
|
||||
@@ -1907,16 +1907,21 @@ CString&
|
||||
CMSWindowsScreen::getDraggingFilename()
|
||||
{
|
||||
if (m_draggingStarted) {
|
||||
// temporarily log out dragging filename
|
||||
char dir[MAX_PATH];
|
||||
m_hookLibraryLoader.m_getDraggingFilename(dir);
|
||||
m_draggingFilename.clear();
|
||||
m_draggingFilename.append(dir);
|
||||
char filename[MAX_PATH];
|
||||
m_hookLibraryLoader.m_getDraggingFilename(filename);
|
||||
m_draggingFilename = filename;
|
||||
}
|
||||
|
||||
return m_draggingFilename;
|
||||
}
|
||||
|
||||
void
|
||||
CMSWindowsScreen::clearDraggingFilename()
|
||||
{
|
||||
LOG((CLOG_DEBUG "clearing stored dragging file name"));
|
||||
m_hookLibraryLoader.m_clearDraggingFilename();
|
||||
}
|
||||
|
||||
const CString&
|
||||
CMSWindowsScreen::getDropTarget() const
|
||||
{
|
||||
|
||||
@@ -116,6 +116,7 @@ public:
|
||||
virtual bool isPrimary() const;
|
||||
virtual void fakeDraggingFiles(CString str);
|
||||
virtual CString& getDraggingFilename();
|
||||
virtual void clearDraggingFilename();
|
||||
virtual const CString&
|
||||
getDropTarget() const;
|
||||
|
||||
|
||||
@@ -904,7 +904,7 @@ COSXScreen::leave()
|
||||
{
|
||||
hideCursor();
|
||||
|
||||
if (getDraggingStarted()) {
|
||||
if (isDraggingStarted()) {
|
||||
CString& fileList = getDraggingFilename();
|
||||
size_t size = fileList.size();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user