diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
commit | a233dac0653f3f3054f7ad2da114ed989747e89a (patch) | |
tree | bf1e11438321c06125a94308649c496648061ccb /vcl/source/app/svmainhook.cxx | |
parent | not link cairocanvas against stl anymore (diff) | |
parent | callcatcher: clean up Dir and DirEntry (diff) | |
download | core-a233dac0653f3f3054f7ad2da114ed989747e89a.tar.gz core-a233dac0653f3f3054f7ad2da114ed989747e89a.zip |
resyncing to master
Diffstat (limited to 'vcl/source/app/svmainhook.cxx')
-rw-r--r-- | vcl/source/app/svmainhook.cxx | 78 |
1 files changed, 1 insertions, 77 deletions
diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx index dd446125a7aa..47c3854a2987 100644 --- a/vcl/source/app/svmainhook.cxx +++ b/vcl/source/app/svmainhook.cxx @@ -31,89 +31,13 @@ #include <tools/tools.h> #ifndef MACOSX +// MacOSX implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx sal_Bool ImplSVMainHook( int * ) { return sal_False; // indicate that ImplSVMainHook is not implemented } -#else -// MACOSX cocoa implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx -#ifndef QUARTZ // MACOSX (X11) needs the CFRunLoop() -#include <osl/thread.h> -#include <premac.h> -#include <CoreFoundation/CoreFoundation.h> -#include <postmac.h> -#include <unistd.h> - -extern sal_Bool ImplSVMain(); - -// ============================================================================ - - -static void SourceContextCallBack( void *pInfo ) -{ -} - -struct ThreadContext -{ - int* pRet; - CFRunLoopRef* pRunLoopRef; -}; - -static void RunSVMain(void *pData) -{ - ThreadContext* tcx = reinterpret_cast<ThreadContext*>(pData); - - // busy waiting (ok in this case) until the run loop is - // running - while (!CFRunLoopIsWaiting(*tcx->pRunLoopRef)) - usleep(100); - - *tcx->pRet = ImplSVMain(); - - // Force exit since some JVMs won't shutdown when only exit() is invoked - _exit( 0 ); -} - -sal_Bool ImplSVMainHook( int *pnInit ) -{ - // Mac OS X requires that any Cocoa code have a CFRunLoop started in the - // primordial thread. Since all of the AWT classes in Java 1.4 and higher - // are written in Cocoa, we need to start the CFRunLoop here and run - // ImplSVMain() in a secondary thread. - // See http://developer.apple.com/samplecode/simpleJavaLauncher/listing3.html - // for further details and an example - - CFRunLoopRef runLoopRef = CFRunLoopGetCurrent(); - ThreadContext tcx; - tcx.pRet = pnInit; // the return value - tcx.pRunLoopRef = &runLoopRef; - oslThread hThreadID = osl_createThread(RunSVMain, &tcx); - - // Start the CFRunLoop - CFRunLoopSourceContext aSourceContext; - aSourceContext.version = 0; - aSourceContext.info = NULL; - aSourceContext.retain = NULL; - aSourceContext.release = NULL; - aSourceContext.copyDescription = NULL; - aSourceContext.equal = NULL; - aSourceContext.hash = NULL; - aSourceContext.schedule = NULL; - aSourceContext.cancel = NULL; - aSourceContext.perform = &SourceContextCallBack; - CFRunLoopSourceRef aSourceRef = CFRunLoopSourceCreate(NULL, 0, &aSourceContext); - CFRunLoopAddSource(runLoopRef, aSourceRef, kCFRunLoopCommonModes); - CFRunLoopRun(); - - osl_joinWithThread( hThreadID ); - osl_destroyThread( hThreadID ); - - return sal_True; // indicate that ImplSVMainHook is implemented -} - -#endif // MACOSX #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |