- using cocoa code to fake mouse button down instead of using synergy code.
- fake a ctrl key up and esc key down and up before leave the screen if there is a dragging operation.
This commit is contained in:
parent
dbc7659776
commit
e9f43fa7c5
|
@ -59,6 +59,9 @@ fakeDragging(const char* str, int length, int cursorX, int cursorY)
|
||||||
[g_dragWindow setFrame:rect display:NO];
|
[g_dragWindow setFrame:rect display:NO];
|
||||||
|
|
||||||
[g_dragWindow makeKeyAndOrderFront:nil];
|
[g_dragWindow makeKeyAndOrderFront:nil];
|
||||||
|
|
||||||
|
CGEventRef down = CGEventCreateMouseEvent(CGEventSourceCreate(kCGEventSourceStateHIDSystemState), kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft);
|
||||||
|
CGEventPost(kCGHIDEventTap, down);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -744,7 +744,6 @@ COSXScreen::showCursor()
|
||||||
#if defined(MAC_OS_X_VERSION_10_7)
|
#if defined(MAC_OS_X_VERSION_10_7)
|
||||||
// TODO: use real file extension
|
// TODO: use real file extension
|
||||||
fakeDragging("txt", 3, m_xCursor, m_yCursor);
|
fakeDragging("txt", 3, m_xCursor, m_yCursor);
|
||||||
fakeMouseButton(kButtonLeft, true);
|
|
||||||
#else
|
#else
|
||||||
LOG((CLOG_WARN "drag drop not supported"));
|
LOG((CLOG_WARN "drag drop not supported"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -911,6 +910,11 @@ COSXScreen::leave()
|
||||||
|
|
||||||
if (m_draggingStarted) {
|
if (m_draggingStarted) {
|
||||||
if (!m_isPrimary) {
|
if (!m_isPrimary) {
|
||||||
|
// fake ctrl key up
|
||||||
|
fakeKeyUp(29);
|
||||||
|
// fake esc key down and up
|
||||||
|
fakeKeyDown(kKeyEscape, 8192, 1);
|
||||||
|
fakeKeyUp(1);
|
||||||
CFStringRef dragInfo = getDraggedFileURL();
|
CFStringRef dragInfo = getDraggedFileURL();
|
||||||
char* dragInfoCStr = CFStringRefToUTF8String(dragInfo);
|
char* dragInfoCStr = CFStringRefToUTF8String(dragInfo);
|
||||||
LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));
|
LOG((CLOG_DEBUG "drag info: %s", dragInfoCStr));
|
||||||
|
|
Loading…
Reference in New Issue