fixed previous commit - the 10.6 compile error was coming from COSXDragView.h, not COSXDragSimulator.m

This commit is contained in:
jerry 2013-08-30 21:17:09 +00:00
parent 6e57005b4a
commit fbfea7b543
5 changed files with 21 additions and 9 deletions

View File

@ -18,13 +18,14 @@
#import <CoreData/CoreData.h> #import <CoreData/CoreData.h>
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#if defined(MAC_OS_X_VERSION_10_7)
NSWindow* g_dragWindow = NULL; NSWindow* g_dragWindow = NULL;
COSXDragView* g_dragView = NULL; 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];
@ -44,13 +45,11 @@ 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);
@ -58,7 +57,6 @@ 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
@ -66,3 +64,5 @@ getCocoaDropTarget()
{ {
return [g_dragView getDropTarget]; return [g_dragView getDropTarget];
} }
#endif

View File

@ -17,6 +17,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#ifdef MAC_OS_X_VERSION_10_7
@interface COSXDragView : NSView<NSDraggingSource,NSDraggingInfo> @interface COSXDragView : NSView<NSDraggingSource,NSDraggingInfo>
{ {
NSMutableString* m_dropTarget; NSMutableString* m_dropTarget;
@ -26,3 +28,5 @@
-(void)clearDropTarget; -(void)clearDropTarget;
@end @end
#endif

View File

@ -604,6 +604,7 @@ COSXScreen::fakeMouseButton(ButtonID id, bool press)
void void
COSXScreen::getDropTargetThread(void*) COSXScreen::getDropTargetThread(void*)
{ {
#if defined(MAC_OS_X_VERSION_10_7)
char* cstr = NULL; char* cstr = NULL;
// wait for 5 secs for the drop destinaiton string to be filled. // wait for 5 secs for the drop destinaiton string to be filled.
@ -628,6 +629,9 @@ COSXScreen::getDropTargetThread(void*)
LOG((CLOG_ERR "failed to get drop target")); LOG((CLOG_ERR "failed to get drop target"));
m_dropTarget.clear(); m_dropTarget.clear();
} }
#else
LOG((CLOG_WARN "drag drop not supported"));
#endif
delete m_getDropTargetThread; delete m_getDropTargetThread;
} }
@ -736,9 +740,13 @@ COSXScreen::showCursor()
m_cursorHidden = false; m_cursorHidden = false;
if (m_fakeDraggingStarted) { if (m_fakeDraggingStarted) {
#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); fakeMouseButton(kButtonLeft, true);
#else
LOG((CLOG_WARN "drag drop not supported"));
#endif
} }
} }

View File

@ -536,7 +536,7 @@ CClientApp::mainLoop()
// that. // that.
DAEMON_RUNNING(true); DAEMON_RUNNING(true);
#if defined(__APPLE__) #if defined(MAC_OS_X_VERSION_10_7)
CThread thread( CThread thread(
new TMethodJob<CClientApp>( new TMethodJob<CClientApp>(
this, &CClientApp::runEventsLoop, this, &CClientApp::runEventsLoop,

View File

@ -787,7 +787,7 @@ CServerApp::mainLoop()
// that. // that.
DAEMON_RUNNING(true); DAEMON_RUNNING(true);
#if defined(__APPLE__) #if defined(MAC_OS_X_VERSION_10_7)
CThread thread( CThread thread(
new TMethodJob<CServerApp>( new TMethodJob<CServerApp>(
this, &CServerApp::runEventsLoop, this, &CServerApp::runEventsLoop,