# HG changeset patch # User Jacob Carlborg # Date 1223817981 -7200 # Node ID 1985493658517cafd5346d9f2b4717071b0957e4 # Parent 642f460a0908aa2db575d184d2cc0c1a8d0a05a7 Fixed all the runtime errors, hello world app "works" diff -r 642f460a0908 -r 198549365851 dwt/dwthelper/File.d --- a/dwt/dwthelper/File.d Fri Oct 10 12:29:48 2008 +0200 +++ b/dwt/dwthelper/File.d Sun Oct 12 15:26:21 2008 +0200 @@ -5,7 +5,7 @@ import dwt.dwthelper.utils; -static import tango.io.FileConst; +static import tango.io.model.IFile; static import tango.io.FilePath; static import tango.io.FileSystem; @@ -19,10 +19,10 @@ private tango.io.FilePath.FilePath mFilePath; static this(){ - separator = tango.io.FileConst.FileConst.PathSeparatorString; - separatorChar = tango.io.FileConst.FileConst.PathSeparatorChar; - pathSeparator = tango.io.FileConst.FileConst.SystemPathString; - pathSeparatorChar = tango.io.FileConst.FileConst.SystemPathChar; + separator = tango.io.model.IFile.FileConst.PathSeparatorString; + separatorChar = tango.io.model.IFile.FileConst.PathSeparatorChar; + pathSeparator = tango.io.model.IFile.FileConst.SystemPathString; + pathSeparatorChar = tango.io.model.IFile.FileConst.SystemPathChar; } public this ( char[] pathname ){ diff -r 642f460a0908 -r 198549365851 dwt/dwthelper/utils.d --- a/dwt/dwthelper/utils.d Fri Oct 10 12:29:48 2008 +0200 +++ b/dwt/dwthelper/utils.d Sun Oct 12 15:26:21 2008 +0200 @@ -258,7 +258,8 @@ public static float NEGATIVE_INFINITY = ((-1.0f) / 0.0f); public static float NaN = (0.0f / 0.0f); public static float MAX_VALUE = 3.4028235e+38f; - public static float MIN_VALUE = 1.4e-45f; + public static float MIN_VALUE = float.min; + //public static float MIN_VALUE = 1.4e-45f; public static int SIZE = 32; this( float value ){ diff -r 642f460a0908 -r 198549365851 dwt/internal/cocoa/OS.d --- a/dwt/internal/cocoa/OS.d Fri Oct 10 12:29:48 2008 +0200 +++ b/dwt/internal/cocoa/OS.d Sun Oct 12 15:26:21 2008 +0200 @@ -35,7 +35,7 @@ static import dwt.internal.objc.foundation.NSRunLoop; static import dwt.internal.objc.runtime; -import mambo.io; +//import mambo.io; private alias dwt.internal.objc.runtime.objc_object objc_object; @@ -107,22 +107,17 @@ static Object JNIGetObject (NSInteger globalRef) { - println("OS->JNIGetObject->globalRef=", globalRef); - auto o = new Object; - o = cast(Object) globalRef; - return o; - //return globalRefs[globalRef - 1]; + return cast(Object)globalRef; } static NSInteger NewGlobalRef (Object object) { - globalRefs ~= object; - return globalRefs.length; + return cast(NSInteger) object; } static void DeleteGlobalRef (NSInteger globalRef) { - globalRefs = globalRefs[0 .. remove!(Object)(globalRefs, globalRef - 1)]; + //globalRefs = globalRefs[0 .. remove!(Object)(globalRefs, globalRef - 1)]; } static size_t remove (T) (T[] arr, size_t index) diff -r 642f460a0908 -r 198549365851 dwt/widgets/Display.d --- a/dwt/widgets/Display.d Fri Oct 10 12:29:48 2008 +0200 +++ b/dwt/widgets/Display.d Sun Oct 12 15:26:21 2008 +0200 @@ -82,7 +82,7 @@ import dwt.widgets.Tray; import dwt.widgets.Widget; -import mambo.io; +//import mambo.io; /** * Instances of this class are responsible for managing the @@ -1668,9 +1668,9 @@ objc.Class cls = OS.objc_allocateClassPair(cast(objc.Class) OS.class_NSObject, className, 0); static if ((void*).sizeof > int.sizeof) // 64bit target - OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "q"); + OS.class_addIvar(cls, "dObject", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "q"); else - OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); + OS.class_addIvar(cls, "dObject", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); OS.class_addMethod(cls, OS.sel_windowDidResize_1, proc3, "@:@"); OS.class_addMethod(cls, OS.sel_windowShouldClose_1, proc3, "@:@"); @@ -3154,17 +3154,17 @@ return null; } -objc.id windowDelegateProc2(objc.id delegate_, objc.SEL selector) { +objc.id windowDelegateProc2(objc.id delegate_, objc.SEL selector) { String sel = fromStringz(selector); - if (sel == OS.sel_tag) { + /*if (sel == OS.sel_tag) { NSInteger* tag; OS.object_getInstanceVariable(delegate_, "tag", cast(void**) &tag); return cast(objc.id) tag[0]; } - NSInteger jniRef = *cast(NSInteger*) OS.objc_msgSend(delegate_, OS.sel_tag); - if (jniRef is 0 || jniRef is -1) return null; - Widget widget = cast(Widget)OS.JNIGetObject(jniRef); + NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegate_, OS.sel_tag); + if (jniRef is 0 || jniRef is -1) return null;*/ + Widget widget = getWidget(delegate_);//cast(Widget)OS.JNIGetObject(jniRef); if (widget is null) return null; if (sel == OS.sel_isFlipped) { return widget.isFlipped() ? cast(objc.id) 1 : null; @@ -3345,4 +3345,12 @@ } return null; } + +Widget getWidget (objc.id ID) +{ + NSInteger* dObject; + OS.object_getInstanceVariable(ID, "dObject", cast(void**)dObject); + if (dObject is null) return null; + return cast(Widget)(*dObject); } +}