|
From: Caspian Rychlik-P. <ci...@us...> - 2003-10-28 16:23:21
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv12258/src/native/macosx Modified Files: org_lwjgl_Sys.cpp Log Message: New Sys.openURL command added Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_Sys.cpp 8 Sep 2003 16:40:52 -0000 1.6 +++ org_lwjgl_Sys.cpp 28 Oct 2003 16:23:17 -0000 1.7 @@ -42,6 +42,7 @@ #include <sched.h> #include <sys/time.h> #include <sys/resource.h> +#include <Carbon/Carbon.h> #include "org_lwjgl_Sys.h" long int hires_timer_freq; // Hires timer frequency @@ -106,7 +107,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority (JNIEnv * env, jclass clazz, jint priority) { - printf("Unsupported"); +#ifdef _DEBUG + printf("Unsupported\n"); +#endif } /* @@ -124,3 +127,31 @@ env->ReleaseStringUTFChars(message, eMessageText); env->ReleaseStringUTFChars(title, cTitleBarText); } + +/* + * Class: org_lwjgl_Sys + * Method: openURL + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_openURL + (JNIEnv * env, jclass clazz, jstring url) +{ + const char * urlString = env->GetStringUTFChars(url, NULL); + + OSStatus err; + ICInstance inst; + long startSel; + long endSel; + Str255 urlStr; + + CopyCStringToPascal(urlString, urlStr); + env->ReleaseStringUTFChars(url, urlString); + + err = ICStart(&inst, '????'); // Use your creator code if you have one! + if (err == noErr) { + startSel = 0; + endSel = urlStr[0]; + err = ICLaunchURL(inst, "\p", (char *) &urlStr[1], urlStr[0], &startSel, &endSel); + (void) ICStop(inst); + } +} \ No newline at end of file |