Linux: ; make gcj platform=Linux target=i686-pc-linux-gnu link_flags="-lX11 -lXext --static"
Solaris: ; make gcj platform=Solaris target=sparc-sun-solaris2.7 link_flags="-lX11 -lXext"
Win32: ; make gcj platform=Win32 target=i686-pc-mingw32 link_flags="-Wl,--subsystem,windows -lcomdlg32" target_bin=xwt.exe
-Darwin: ; make gcj platform=Darwin target=powerpc-apple-darwin link_flags=-Wl,-framework,Carbon,-framework,OpenGL,-framework,AGL,-framework,SystemConfiguration
+Darwin: ; make gcj platform=Darwin target=powerpc-apple-darwin link_flags="-lgcj -lSystem -lgcc -lmathCommon.A upstream/install/powerpc-apple-darwin/lib/crt1.o"
#############################################################################
gcc_optimizations := -O2
#gcc_optimizations := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls
#gcc_optimizations += -finline-functions -funroll-loops -ffunction-sections -fdata-sections
-gcc_flags := -nostdinc $(gcc_optimizations) -Ibuild/h -Iupstream/jpeg-6b/src/
+gcc_flags := -nostdinc $(gcc_optimizations) -Ibuild/h -Iupstream/jpeg-6b/src/ -Iupstream/jpeg-6b/build-$(target)/
gcj_flags := -fCLASSPATH=build/java
gcj := upstream/install/bin/$(target)-gcj $(gcc_flags) $(gcj_flags)
-g++ := upstream/install/bin/$(target)-g++ $(gcc_flags)
+g++ := upstream/install/bin/$(target)-gcj $(gcc_flags)
gcc := upstream/install/bin/$(target)-gcc $(gcc_flags)
jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
jpeg_c_sources := jdapimin.c jdapistd.c jcomapi.c jcparam.c jdmaster.c jdinput.c jdmainct.c jdcoefct.c jdpostct.c jdmarker.c
jpeg_c_sources += jdhuff.c jdphuff.c jddctmgr.c jidctint.c jidctfst.c jidctflt.c jidctred.c jdsample.c jdcolor.c jdmerge.c
jpeg_c_sources += jquant1.c jquant2.c jerror.c jutils.c jmemnobs.c jmemmgr.c
-
-upstream/jpeg-6b/src/%.c: download_jpeg-6b
+upstream/jpeg-6b/src/%.c: .download_jpeg-6b
freetype_sources := ftsystem.c ftmm.c ftbbox.c ftinit.c ftdebug.c ftbase.c ftglyph.c smooth.c sfnt.c truetype.c
-upstream/freetype-2.1.4/%.c: download_freetype-2.1.4
+upstream/freetype-2.1.4/%.c: .download_freetype-2.1.4
java_sources := $(patsubst src/%.java, build/java/%.java, $(shell find src -name \*.java))
java_sources += $(patsubst src/%.java.pp, build/java/%.java, $(shell find src -name \*.java.pp))
sed s_build/class/__ | sed s/.class\$$//g | sed s_/_._g | (cd build/class; xargs ../../upstream/install/bin/$(target)-gcjh -d ../h --classpath .)
# a hack since we've disabled gcj's awt implementation
-build/$(platform)/org/xwt/plat/Java2.java.o: ; mkdir -p $(@D); touch $@
-build/$(platform)/org/xwt/plat/AWT.java.o: ; mkdir -p $(@D); touch $@
+build/$(platform)/org/xwt/plat/Java2.java.o:
+ touch .empty.c; mkdir -p $(@D); $(gcc) -c .empty.c -o $@;
+build/$(platform)/org/xwt/plat/AWT.java.o:
+ touch .empty.c; mkdir -p $(@D); $(gcc) -c .empty.c -o $@;
build/$(platform)/%.java.o: build/java/%.java
@echo -e "\n\033[1mcompiling .java -> .o: $<\033[0m"
mkdir -p `dirname $@`
$(gcj) -c $< -o $@
-build/$(platform)/org/xwt/plat/$(platform).cc.o: src/org/xwt/plat/$(platform).cc src/org/xwt/plat/*.cc $(java_headers)
+build/$(platform)/org/xwt/plat/$(platform).cc.o: src/org/xwt/plat/$(platform).cc src/org/xwt/plat/*.cc $(java_headers) .configure_jpeg-6b_$(target)
@echo -e "\n\033[1mcompiling .cc -> .o: $<\033[0m"
mkdir -p `dirname $@`
- $(g++) -I/usr/X11R6/include/ -Iupstream/install/include -Ibuild/h -Iupstream/$(target)/include -Wno-multichar -c $< -o $@
+ $(g++) -Iupstream/install/lib/gcc-lib/$(target)/3.3/include/ -Iupstream/install/$(target)/include -I/usr/X11R6/include/ -Ibuild/h -Wno-multichar -Iupstream/install/include -c $< -o $@
build/$(platform)/jpeg-6b/%.c.o: upstream/jpeg-6b/src/%.c
@echo -e "\n\033[1mcompiling .c -> .o: $<\033[0m"
@echo -e "\n\033[1marchiving .o -> $(target_bin).ar\033[0m"
rm -f $(target_bin).ar
upstream/install/$(target)/bin/ar -cq $(target_bin).ar $^
+ upstream/install/$(target)/bin/ranlib $(target_bin).ar
$(target_bin): $(target_bin).ar
@echo -e "\n\033[1mlinking .o -> $(target_bin)\033[0m"
mkdir -p build/$(platform)
- $(gcj) -nostdlib --main=org.xwt.Main -o build/$(platform)/$(target_bin) $(target_bin).ar -Lupstream/install/$(target)/lib $(link_flags)
+ PATH=upstream/install/bin:$$PATH $(gcj) -nostdlib --main=org.xwt.Main -o build/$(platform)/$(target_bin) $(target_bin).ar -Lupstream/install/$(target)/lib $(link_flags)
##############################################################################
#include <java/lang/Object.h>
#include <java/lang/Error.h>
-#include <org/xwt/plat/Carbon.h>
-#include <org/xwt/plat/Carbon$CarbonSurface.h>
-#include <org/xwt/plat/Carbon$GLCarbonSurface.h>
-#include <org/xwt/plat/Carbon$GLCarbonDoubleBuffer.h>
-#include <org/xwt/plat/Carbon$CarbonMessage.h>
-#include <org/xwt/plat/Carbon$CarbonOpenGL.h>
-#include <org/xwt/plat/Carbon$FileDialogHelper.h>
+#include <org/xwt/plat/Darwin.h>
+#include <org/xwt/plat/Darwin$CarbonSurface.h>
+#include <org/xwt/plat/Darwin$GLCarbonSurface.h>
+#include <org/xwt/plat/Darwin$GLCarbonDoubleBuffer.h>
+#include <org/xwt/plat/Darwin$CarbonMessage.h>
+#include <org/xwt/plat/Darwin$CarbonOpenGL.h>
+#include <org/xwt/plat/Darwin$FileDialogHelper.h>
#include <org/xwt/plat/GCJ$Retainer.h>
#include <org/xwt/Proxy.h>
#include <org/xwt/util/Semaphore.h>
namespace org { namespace xwt { namespace plat {
-namespace carbon { }
-using namespace carbon;
+namespace darwin { }
+using namespace darwin;
#pragma mark ------ Carbon Namespace ------
-namespace carbon {
- // We put everything that isn't in org.xwt.plat.Carbon in
- // org.xwt.plat.carbon to prevent namespace conflicts
+namespace darwin {
+ // We put everything that isn't in org.xwt.plat.Darwin in
+ // org.xwt.plat.darwin to prevent namespace conflicts
template <bool CHECK> static inline int CompileTimeCheck() { const int something_is_wrong=1; something_is_wrong++; return 0; }
template <> static inline int CompileTimeCheck<true>() { return 0; }
const static UInt32 kEventCarbonMessage = 'xwtb';
const static UInt32 kEventParamCarbonMessage = 'xwtc';
- pascal OSStatus carbon::carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData);
+ pascal OSStatus darwin::carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData);
void fileDialogEventHandler(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *userData);
} // end namespace
-jboolean Carbon::isJaguar() {
+jboolean Darwin::isJaguar() {
SInt32 version;
OSStatus r = Gestalt(gestaltSystemVersion, &version);
checkStatus(r,"Gestalt");
return version >= 0x1020;
}
-void Carbon$CarbonMessage::natInit() {
+void Darwin$CarbonMessage::natInit() {
OSStatus r;
EventHandlerUPP upp = NewEventHandlerUPP(carbonMessageEventHandler);
checkStatus(r,"InstallEventHandler");
}
-void Carbon$CarbonMessage::add(Carbon$CarbonMessage *msg) {
+void Darwin$CarbonMessage::add(Darwin$CarbonMessage *msg) {
EventRef event;
OSStatus r;
}
-pascal OSStatus carbon::carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
+pascal OSStatus darwin::carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
UInt32 eKind = GetEventKind(e);
UInt32 eClass = GetEventClass(e);
OSStatus r;
- Carbon$CarbonMessage *msg;
+ Darwin$CarbonMessage *msg;
if(eClass != kEventClassCarbonMessage || eKind != kEventCarbonMessage)
return eventNotHandledErr;
r = GetEventParameter(e,kEventParamCarbonMessage,typeVoidPtr,NULL,sizeof(msg),NULL,&msg);
#pragma mark ------ Utility Functions ------
-void carbon::funcFailed(char *func,int r){
+void darwin::funcFailed(char *func,int r){
fprintf(stderr,"%s() failed (%d)\n",func,r);
exit(EXIT_FAILURE);
}
#pragma mark ----- Carbon Surface Methods ----
-void Carbon$CarbonSurface::natSyncCursor(jint n) {
+void Darwin$CarbonSurface::natSyncCursor(jint n) {
ThemeCursor c;
// see Carbon.java for what these numbers mean
switch(n) {
SetThemeCursor(c);
}
-void Carbon$CarbonSurface::natSetInvisible(jboolean b) {
+void Darwin$CarbonSurface::natSetInvisible(jboolean b) {
WindowRef window = (WindowRef) rawWindowRef;
fprintf(stderr,"Making window %s\n",b?"invisible":"visible");
if(b) HideWindow(window);
else ShowWindow(window);
}
-void Carbon$CarbonSurface::nat_setMaximized(jboolean b) {
+void Darwin$CarbonSurface::nat_setMaximized(jboolean b) {
WindowRef window = (WindowRef) rawWindowRef;
Point ideal = { 10000, 10000 };
OSStatus r = ZoomWindowIdeal(window,(b?inZoomOut:inZoomIn),&ideal);
checkStatus(r,"ZoomWindowIdeal");
}
-void Carbon$CarbonSurface::nat_setMinimized(jboolean b) {
+void Darwin$CarbonSurface::nat_setMinimized(jboolean b) {
WindowRef window = (WindowRef) rawWindowRef;
if((IsWindowCollapsed(window) ? 1 : 0) == (b ? 1 : 0)) return;
OSStatus r = CollapseWindow(window,b);
checkStatus(r,"CollapseWindow");
}
-void Carbon$CarbonSurface::natSetTitleBarText(jstring js) {
+void Darwin$CarbonSurface::natSetTitleBarText(jstring js) {
SmartCFString s = js;
WindowRef window = (WindowRef) rawWindowRef;
SetWindowTitleWithCFString(window,s);
}
-void Carbon$CarbonSurface::natToBack() {
+void Darwin$CarbonSurface::natToBack() {
WindowRef window = (WindowRef) rawWindowRef;
SendBehind(window,NULL);
}
-void Carbon$CarbonSurface::natToFront() {
+void Darwin$CarbonSurface::natToFront() {
WindowRef window = (WindowRef) rawWindowRef;
fprintf(stderr,"SelectWindow()\n");
SelectWindow(window);
}
#pragma mark ---- Window Event Handler ----
-namespace carbon {
+namespace darwin {
static const EventTypeSpec eventTypeSpecs[] = {
// kEventClassCommand
// { kEventClassCommand, ??? },
};
pascal OSStatus windowEventHandler(EventHandlerCallRef handler, EventRef e, void *userData) {
- Carbon$CarbonSurface *surface = (Carbon$CarbonSurface*) userData;
+ Darwin$CarbonSurface *surface = (Darwin$CarbonSurface*) userData;
UInt32 eKind = GetEventKind(e);
UInt32 eClass = GetEventClass(e);
OSStatus r;
r = GetEventParameter(e,kEventParamDirectObject,typeWindowRef,NULL,sizeof(window),NULL,&window);
checkStatus(r,"kEventClassWindow/GetEventParameter");
- if((RawData*)window != surface->rawWindowRef) Carbon::abort(JvNewStringLatin1("window != surface->window"));
+ if((RawData*)window != surface->rawWindowRef) Darwin::abort(JvNewStringLatin1("window != surface->window"));
switch(eKind) {
case kEventWindowUpdate: {
- surface->Dirty(0,0,surface->width,surface->height);
+ surface->Dirty(0,0,surface->root->width,surface->root->height);
return noErr;
}
case kEventWindowBoundsChanged: {
}
} // end namespace
-void Carbon$CarbonSurface::natInit(jboolean framed) {
+void Darwin$CarbonSurface::natInit(jboolean framed) {
WindowRef window;
Rect rect;
WindowClass wc = framed ? kDocumentWindowClass : kPlainWindowClass;
rawEventHandlerUPP = (RawData*) upp;
}
-void Carbon$CarbonSurface::natDispose() {
+void Darwin$CarbonSurface::natDispose() {
WindowRef window = (WindowRef) rawWindowRef;
DisposeWindow(window);
}
-void Carbon$CarbonSurface::natSetIcon(org::xwt::Picture *_p) {
+void Darwin$CarbonSurface::natSetIcon(org::xwt::Picture *_p) {
}
-void Carbon$CarbonSurface::natSetLocation(jint x, jint y) {
+void Darwin$CarbonSurface::natSetLocation(jint x, jint y) {
WindowRef window = (WindowRef) rawWindowRef;
Rect rect;
OSStatus r = GetWindowBounds(window,kWindowStructureRgn,&rect);
checkStatus(r,"ConstrainWindowToScreen");
}
-void Carbon$CarbonSurface::natSetSize(jint w, jint h) {
+void Darwin$CarbonSurface::natSetSize(jint w, jint h) {
WindowRef window = (WindowRef) rawWindowRef;
Rect rect;
OSStatus r = GetWindowBounds(window,kWindowStructureRgn,&rect);
checkStatus(r,"ConstrainWindowToScreen");
}
-void Carbon$CarbonSurface::natSetLimits(jint minw, jint minh, jint maxw, jint maxh) {
+void Darwin$CarbonSurface::natSetLimits(jint minw, jint minh, jint maxw, jint maxh) {
WindowRef window = (WindowRef) rawWindowRef;
const int maxMax = 32767;
const int minMinW = 80;
#pragma mark ------ Carbon Methods ------
-void carbon::fileDialogEventHandler(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *userData) {
- Carbon$FileDialogHelper *helper = (Carbon$FileDialogHelper*) userData;
+void darwin::fileDialogEventHandler(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *userData) {
+ Darwin$FileDialogHelper *helper = (Darwin$FileDialogHelper*) userData;
NavDialogRef dialog = callBackParms->context;
OSStatus r;
switch(callBackSelector) {
}
}
-void Carbon::natFileDialog(Carbon$FileDialogHelper *helper,jstring suggestion_, jboolean write) {
+void Darwin::natFileDialog(Darwin$FileDialogHelper *helper,jstring suggestion_, jboolean write) {
NavDialogRef dlg;
SmartCFString suggestion = suggestion_;
CFStringRef message = CFSTR("By selecting a file in this dialog you are giving this XWT application permission to access that file.");
WindowRef window = FrontWindow();
NavDialogCreationOptions options;
- NavEventUPP handler = NewNavEventUPP(carbon::fileDialogEventHandler);
+ NavEventUPP handler = NewNavEventUPP(darwin::fileDialogEventHandler);
NavGetDefaultDialogCreationOptions(&options);
options.optionFlags =
NavDialogRun(dlg);
}
-jstring Carbon::natGetClipBoard() {
+jstring Darwin::natGetClipBoard() {
ScrapRef scrap;
OSStatus r;
Size size,size2;
return js;
}
-void Carbon::natSetClipBoard(jstring js) {
+void Darwin::natSetClipBoard(jstring js) {
unsigned int length = js->length();
ScrapRef scrap;
OSStatus r;
checkStatus(r,"PutScrapFlavor");
}
-Proxy *Carbon::natDetectProxy() {
+Proxy *Darwin::natDetectProxy() {
using org::xwt::Proxy;
Proxy *p=0;
CFStringRef string;
*/
}
-jint Carbon::cgScreenWidth() {
+jint Darwin::cgScreenWidth() {
return CGDisplayPixelsWide(kCGDirectMainDisplay);
}
-jint Carbon::cgScreenHeight() {
+jint Darwin::cgScreenHeight() {
return CGDisplayPixelsHigh(kCGDirectMainDisplay);
}
-void Carbon::_newBrowserWindow(jstring js) {
+void Darwin::_newBrowserWindow(jstring js) {
SmartCFString cfs = js;
CFURLRef url = CFURLCreateWithString(kCFAllocatorDefault,cfs,NULL);
SmartCFString scheme = CFURLCopyScheme(url);
CFRelease(url);
}
-void Carbon::_exit() {
+void Darwin::_exit() {
QuitApplicationEventLoop();
}
OSErr CPSSetFrontProcess(ProcessSerialNumber *psn);
}
#endif
-void Carbon::natInit() {
+void Darwin::natInit() {
OSStatus r;
#ifdef XWT_CARBON_NO_BUNDLE_HACK
{
#endif
}
-void Carbon::_running() {
+void Darwin::_running() {
RunApplicationEventLoop();
ExitToShell();
}
#pragma mark ------ OpenGL Functions -----
-void Carbon$CarbonOpenGL::activateSharedContext() {
+void Darwin$CarbonOpenGL::activateSharedContext() {
AGLContext ctx = (AGLContext) rawSharedContext;
aglSetCurrentContext(ctx);
}
-jboolean Carbon$CarbonOpenGL::initPixelFormat() {
+jboolean Darwin$CarbonOpenGL::initPixelFormat() {
GLint attr[] = {
AGL_NO_RECOVERY,
AGL_RGBA,
return rawPixelFormat != 0;
}
-void Carbon$CarbonOpenGL::initSharedContext() {
+void Darwin$CarbonOpenGL::initSharedContext() {
AGLPixelFormat fmt = (AGLPixelFormat) rawPixelFormat;
rawSharedContext = (RawData*) aglCreateContext(fmt,NULL);
checkStatus(rawSharedContext,"aglCreateContext");
}
-void Carbon$GLCarbonDoubleBuffer::natInit() {
+void Darwin$GLCarbonDoubleBuffer::natInit() {
WindowClass wc = kPlainWindowClass;
WindowAttributes attr = 0;
WindowRef window;
rawCTX = (RawData*) ctx;
}
-void Carbon$GLCarbonDoubleBuffer::activateContext() {
+void Darwin$GLCarbonDoubleBuffer::activateContext() {
AGLContext ctx = (AGLContext) rawCTX;
aglSetCurrentContext(ctx);
}
-void Carbon$GLCarbonDoubleBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) {
+void Darwin$GLCarbonDoubleBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) {
WindowRef window = (WindowRef) rawWindowRef;
AGLContext ctx = (AGLContext) rawCTX;
aglDestroyContext(ctx);
DisposeWindow(window);
}
-void Carbon$GLCarbonSurface::natBlit(Carbon$GLCarbonDoubleBuffer *db, jint sx1, jint sy1, jint dx1, jint dy1, jint dx2, jint dy2) {
+void Darwin$GLCarbonSurface::natBlit(Darwin$GLCarbonDoubleBuffer *db, jint sx1, jint sy1, jint dx1, jint dy1, jint dx2, jint dy2) {
AGLContext ctx = (AGLContext) rawCTX;
int sx2 = sx1 + (dx2-dx1);
int sy2 = sy1 + (dy2-dy1);
glFlush();
}
-void Carbon$GLCarbonSurface::natReshape(jint w, jint h) {
+void Darwin$GLCarbonSurface::natReshape(jint w, jint h) {
AGLContext ctx = (AGLContext) rawCTX;
aglSetCurrentContext (ctx);
checkGLError();
}
-void Carbon$GLCarbonSurface::natInit() {
+void Darwin$GLCarbonSurface::natInit() {
WindowRef window = (WindowRef) rawWindowRef;
AGLContext ctx,shared;
AGLPixelFormat fmt;
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
-void Carbon$GLCarbonSurface::natDispose() {
+void Darwin$GLCarbonSurface::natDispose() {
AGLContext ctx = (AGLContext) rawCTX;
aglDestroyContext(ctx);
- Carbon$CarbonSurface::natDispose();
+ Darwin$CarbonSurface::natDispose();
}
} } } // end namepsace org::xwt::plat