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 <Cocoa/Cocoa.h>
#if defined(MAC_OS_X_VERSION_10_7)
NSWindow* g_dragWindow = NULL;
COSXDragView* g_dragView = NULL;
void
runCocoaApp()
{
#ifdef MAC_OS_X_VERSION_10_7
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSApplication* app = [[NSApplication alloc] init];
@ -44,13 +45,11 @@ runCocoaApp()
[app run];
[pool release];
#endif
}
void
fakeDragging(const char* str, int length, int cursorX, int cursorY)
{
#ifdef MAC_OS_X_VERSION_10_7
dispatch_async(dispatch_get_main_queue(), ^{
NSRect screen = [[NSScreen mainScreen] frame];
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 makeKeyWindow];
});
#endif
}
CFStringRef
@ -66,3 +64,5 @@ getCocoaDropTarget()
{
return [g_dragView getDropTarget];
}
#endif

View File

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

View File

@ -604,6 +604,7 @@ COSXScreen::fakeMouseButton(ButtonID id, bool press)
void
COSXScreen::getDropTargetThread(void*)
{
#if defined(MAC_OS_X_VERSION_10_7)
char* cstr = NULL;
// 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"));
m_dropTarget.clear();
}
#else
LOG((CLOG_WARN "drag drop not supported"));
#endif
delete m_getDropTargetThread;
}
@ -736,9 +740,13 @@ COSXScreen::showCursor()
m_cursorHidden = false;
if (m_fakeDraggingStarted) {
#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
}
}

View File

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

View File

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