limited drag file feature only for mac 10.7 or above

This commit is contained in:
jerry 2013-08-30 20:18:13 +00:00
parent 9d62232a72
commit 6e57005b4a
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,7 @@ COSXDragView* g_dragView = NULL;
void void
runCocoaApp() runCocoaApp()
{ {
#ifdef MAC_OS_X_VERSION_10_7
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSApplication* app = [[NSApplication alloc] init]; NSApplication* app = [[NSApplication alloc] init];
@ -43,11 +44,13 @@ runCocoaApp()
[app run]; [app run];
[pool release]; [pool release];
#endif
} }
void void
fakeDragging(const char* str, int length, int cursorX, int cursorY) fakeDragging(const char* str, int length, int cursorX, int cursorY)
{ {
#ifdef MAC_OS_X_VERSION_10_7
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
NSRect screen = [[NSScreen mainScreen] frame]; NSRect screen = [[NSScreen mainScreen] frame];
NSLog ( @"mouseLocation: %d %d", cursorX, cursorY); NSLog ( @"mouseLocation: %d %d", cursorX, cursorY);
@ -55,6 +58,7 @@ fakeDragging(const char* str, int length, int cursorX, int cursorY)
[g_dragWindow setFrame:rect display:YES]; [g_dragWindow setFrame:rect display:YES];
[g_dragWindow makeKeyWindow]; [g_dragWindow makeKeyWindow];
}); });
#endif
} }
CFStringRef CFStringRef