#define APPLE_GCC
#endif
+#define __private_extern__
+#include <mach-o/dyld.h>
+
#include "POSIX.cc"
#include "OpenGL.cc"
#include <org/xwt/Proxy.h>
#include <org/xwt/util/Semaphore.h>
-#include <Carbon/Carbon.h>
-#include <CoreFoundation/CoreFoundation.h>
-// For proxy stuff
-#include <SystemConfiguration/SystemConfiguration.h>
-// For LSOpenURLRef
-#include <ApplicationServices/ApplicationServices.h>
+#include <stdlib.h>
-#include <AGL/agl.h>
+#include "DarwinCarbonHeaders.h"
-#include <stdlib.h>
+#define XWT_CARBON_NO_BUNDLE_HACK
+#ifdef XWT_CARBON_NO_BUNDLE_HACK
+extern "C" {
+ OSErr CPSEnableForegroundOperation(ProcessSerialNumber *psn);
+ OSErr CPSSetFrontProcess(ProcessSerialNumber *psn);
+}
+#endif
+
+#include "DarwinWeakSymbols.h"
using namespace org::xwt::plat;
using gnu::gcj::RawData;
namespace darwin { }
using namespace darwin;
-#pragma mark ------ Carbon Namespace ------
-namespace darwin {
+#pragma mark ------ Darwin Namespace ------
+
// We put everything that isn't in org.xwt.plat.Darwin in
// org.xwt.plat.darwin to prevent namespace conflicts
const static UInt32 kEventCarbonMessage = 'xwtb';
const static UInt32 kEventParamCarbonMessage = 'xwtc';
- pascal OSStatus darwin::carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData);
+ OSStatus our_carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData);
void fileDialogEventHandler(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *userData);
-} // end namespace
+
jboolean Darwin::isJaguar() {
SInt32 version;
return version >= 0x1020;
}
+void Darwin::linkMe() {
+ load_weak_symbols();
+}
+
void Darwin$CarbonMessage::natInit() {
OSStatus r;
- EventHandlerUPP upp = NewEventHandlerUPP(carbonMessageEventHandler);
+ EventHandlerUPP upp = NewEventHandlerUPP(our_carbonMessageEventHandler);
EventTypeSpec eventTypes = { kEventClassCarbonMessage, kEventCarbonMessage };
r = InstallEventHandler(GetApplicationEventTarget(),upp,1,&eventTypes,NULL,NULL);
checkStatus(r,"InstallEventHandler");
}
-pascal OSStatus darwin::carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
+OSStatus our_carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
UInt32 eKind = GetEventKind(e);
UInt32 eClass = GetEventClass(e);
OSStatus r;
#pragma mark ------ Utility Functions ------
-void darwin::funcFailed(char *func,int r){
+void funcFailed(char *func,int r){
fprintf(stderr,"%s() failed (%d)\n",func,r);
exit(EXIT_FAILURE);
}
{ kEventClassMouse, kEventMouseWheelMoved },
};
-pascal OSStatus windowEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
+OSStatus our_windowEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
Darwin$CarbonSurface *surface = (Darwin$CarbonSurface*) userData;
UInt32 eKind = GetEventKind(e);
UInt32 eClass = GetEventClass(e);
checkStatus(r,"CreateNewWindow");
GCJ$Retainer::retain(this); // Need to account for the EventHandlers pointer to us
- EventHandlerUPP upp = NewEventHandlerUPP(windowEventHandler);
+ EventHandlerUPP upp = NewEventHandlerUPP(our_windowEventHandler);
r = InstallWindowEventHandler(window,upp,sizeof(eventTypeSpecs)/sizeof(EventTypeSpec),eventTypeSpecs,this,NULL);
checkStatus(r,"InstallWindowEventHandler");
#pragma mark ------ Carbon Methods ------
-void darwin::fileDialogEventHandler(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *userData) {
+void fileDialogEventHandler(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *userData) {
Darwin$FileDialogHelper *helper = (Darwin$FileDialogHelper*) userData;
NavDialogRef dialog = callBackParms->context;
OSStatus r;
WindowRef window = FrontWindow();
NavDialogCreationOptions options;
- NavEventUPP handler = NewNavEventUPP(darwin::fileDialogEventHandler);
+ NavEventUPP handler = NewNavEventUPP(fileDialogEventHandler);
NavGetDefaultDialogCreationOptions(&options);
options.optionFlags =
}
jint Darwin::cgScreenWidth() {
- return CGDisplayPixelsWide(kCGDirectMainDisplay);
+ return CGDisplayPixelsWide(((CGDirectDisplayID)0));
}
jint Darwin::cgScreenHeight() {
- return CGDisplayPixelsHigh(kCGDirectMainDisplay);
+ return CGDisplayPixelsHigh(((CGDirectDisplayID)0));
}
void Darwin::_newBrowserWindow(jstring js) {
QuitApplicationEventLoop();
}
-#define XWT_CARBON_NO_BUNDLE_HACK
-#ifdef XWT_CARBON_NO_BUNDLE_HACK
-extern "C" {
- OSErr CPSEnableForegroundOperation(ProcessSerialNumber *psn);
- OSErr CPSSetFrontProcess(ProcessSerialNumber *psn);
-}
-#endif
void Darwin::natInit() {
OSStatus r;
#ifdef XWT_CARBON_NO_BUNDLE_HACK
}
} } } // end namepsace org::xwt::plat
+
+
+