Kaydet (Commit) 44fb00ef authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Bin dead MacOSX X11 code

üst ce0ecd94
...@@ -31,89 +31,13 @@ ...@@ -31,89 +31,13 @@
#include <tools/tools.h> #include <tools/tools.h>
#ifndef MACOSX #ifndef MACOSX
// MacOSX implementation of ImplSVMainHook is in aqua/source/app/salinst.cxx
sal_Bool ImplSVMainHook( int * ) sal_Bool ImplSVMainHook( int * )
{ {
return sal_False; // indicate that ImplSVMainHook is not implemented 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 #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment