Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/OS.d @ 130:3d4579727e0e
Fixes #2 and #3
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 10 Feb 2009 21:01:24 +0100 |
parents | 38807a925e24 |
children | 3d9eb62cd2e3 |
comparison
equal
deleted
inserted
replaced
129:ad4e1fe71a5a | 130:3d4579727e0e |
---|---|
30 NSLineBorder = 1, | 30 NSLineBorder = 1, |
31 NSBezelBorder = 2, | 31 NSBezelBorder = 2, |
32 NSGrooveBorder = 3 | 32 NSGrooveBorder = 3 |
33 } | 33 } |
34 | 34 |
35 | |
36 | |
35 import dwt.dwthelper.utils; | 37 import dwt.dwthelper.utils; |
36 | 38 |
37 import dwt.internal.C; | 39 import dwt.internal.C; |
38 import dwt.internal.Library; | 40 import dwt.internal.Library; |
39 | 41 |
42 import tango.core.Memory; | |
40 import unistd = tango.stdc.posix.unistd; | 43 import unistd = tango.stdc.posix.unistd; |
41 import stdc = tango.stdc.string; | 44 import stdc = tango.stdc.string; |
42 | 45 |
43 import Carbon = dwt.internal.c.Carbon; | 46 import Carbon = dwt.internal.c.Carbon; |
44 import custom = dwt.internal.c.custom; | 47 import custom = dwt.internal.c.custom; |
1359 /** JNI natives */ | 1362 /** JNI natives */ |
1360 | 1363 |
1361 /** @method flags=jni */ | 1364 /** @method flags=jni */ |
1362 public static void* NewGlobalRef (Object object) | 1365 public static void* NewGlobalRef (Object object) |
1363 { | 1366 { |
1364 return cast(void*) object; | 1367 auto o = cast(void*) object; |
1368 GC.addRoot(o); | |
1369 | |
1370 return o; | |
1365 } | 1371 } |
1366 /** | 1372 /** |
1367 * @method flags=jni | 1373 * @method flags=jni |
1368 * @param globalRef cast=(jobject) | 1374 * @param globalRef cast=(jobject) |
1369 */ | 1375 */ |
1370 //public static final void DeleteGlobalRef(void* globalRef){} | 1376 public static void DeleteGlobalRef(void* globalRef) |
1377 { | |
1378 GC.removeRoot(globalRef); | |
1379 } | |
1371 /** @method flags=no_gen */ | 1380 /** @method flags=no_gen */ |
1372 public static Object JNIGetObject (void* globalRef) | 1381 public static Object JNIGetObject (void* globalRef) |
1373 { | 1382 { |
1374 return cast(Object) globalRef; | 1383 return cast(Object) globalRef; |
1375 } | 1384 } |