diff --git a/src/lib/platform/COSXDragSimulator.m b/src/lib/platform/COSXDragSimulator.m index 4c36d684..b85cdb22 100644 --- a/src/lib/platform/COSXDragSimulator.m +++ b/src/lib/platform/COSXDragSimulator.m @@ -59,6 +59,9 @@ fakeDragging(const char* str, int length, int cursorX, int cursorY) [g_dragWindow setFrame:rect display:NO]; [g_dragWindow makeKeyAndOrderFront:nil]; + + CGEventRef down = CGEventCreateMouseEvent(CGEventSourceCreate(kCGEventSourceStateHIDSystemState), kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft); + CGEventPost(kCGHIDEventTap, down); }); } diff --git a/src/lib/platform/COSXScreen.cpp b/src/lib/platform/COSXScreen.cpp index 948c4774..a1d4ea9e 100644 --- a/src/lib/platform/COSXScreen.cpp +++ b/src/lib/platform/COSXScreen.cpp @@ -744,7 +744,6 @@ COSXScreen::showCursor() #if defined(MAC_OS_X_VERSION_10_7) // TODO: use real file extension fakeDragging("txt", 3, m_xCursor, m_yCursor); - fakeMouseButton(kButtonLeft, true); #else LOG((CLOG_WARN "drag drop not supported")); #endif @@ -911,6 +910,11 @@ COSXScreen::leave() if (m_draggingStarted) { if (!m_isPrimary) { + // fake ctrl key up + fakeKeyUp(29); + // fake esc key down and up + fakeKeyDown(kKeyEscape, 8192, 1); + fakeKeyUp(1); CFStringRef dragInfo = getDraggedFileURL(); char* dragInfoCStr = CFStringRefToUTF8String(dragInfo); LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));