[kaffe] CVS kaffe (guilhem): Nano-X bug fixes.

Kaffe CVS cvs-commits at kaffe.org
Wed Mar 8 13:18:52 PST 2006


PatchSet 7143 
Date: 2006/03/08 21:07:46
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Nano-X bug fixes.

        Fix bug #23

        * libraries/clib/awt/nano-X/Makefile.in: Regenerated.

        * libraries/clib/awt/nano-X/Makefile.am,
        libraries/clib/awt/nano-X/clipboard.c,
        libraries/clib/awt/nano-X/event.c,
        libraries/clib/awt/nano-X/font.c,
        libraries/clib/awt/nano-X/graphics.c,
        libraries/clib/awt/nano-X/image.c,
        libraries/clib/awt/nano-X/window.c: Adapted to Classpath's RawData
        structure.

Members: 
	ChangeLog:1.4661->1.4662 
	libraries/clib/awt/nano-X/Makefile.am:1.3->1.4 
	libraries/clib/awt/nano-X/Makefile.in:1.35->1.36 
	libraries/clib/awt/nano-X/clipboard.c:1.1->1.2 
	libraries/clib/awt/nano-X/event.c:1.1->1.2 
	libraries/clib/awt/nano-X/font.c:1.2->1.3 
	libraries/clib/awt/nano-X/graphics.c:1.1->1.2 
	libraries/clib/awt/nano-X/image.c:1.1->1.2 
	libraries/clib/awt/nano-X/window.c:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4661 kaffe/ChangeLog:1.4662
--- kaffe/ChangeLog:1.4661	Wed Mar  8 01:42:42 2006
+++ kaffe/ChangeLog	Wed Mar  8 21:07:46 2006
@@ -1,3 +1,18 @@
+2006-03-08  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	Fix bug #23
+	
+	* libraries/clib/awt/nano-X/Makefile.in: Regenerated.
+	
+	* libraries/clib/awt/nano-X/Makefile.am,
+	libraries/clib/awt/nano-X/clipboard.c,
+	libraries/clib/awt/nano-X/event.c,
+	libraries/clib/awt/nano-X/font.c,
+	libraries/clib/awt/nano-X/graphics.c,
+	libraries/clib/awt/nano-X/image.c,
+	libraries/clib/awt/nano-X/window.c: Adapted to Classpath's RawData
+	structure.
+
 2006-03-08  Dalibor Topic  <robilad at kaffe.org>
 
 	* Resynchronized GNU Classpath 0.90. Reapplied patch for
Index: kaffe/libraries/clib/awt/nano-X/Makefile.am
diff -u kaffe/libraries/clib/awt/nano-X/Makefile.am:1.3 kaffe/libraries/clib/awt/nano-X/Makefile.am:1.4
--- kaffe/libraries/clib/awt/nano-X/Makefile.am:1.3	Mon Sep 19 02:52:08 2005
+++ kaffe/libraries/clib/awt/nano-X/Makefile.am	Wed Mar  8 21:07:48 2006
@@ -15,7 +15,8 @@
 
 AM_CPPFLAGS = \
 	-I$(top_builddir)/include \
-	-I$(top_srcdir)/kaffe/kaffevm/jni
+	-I$(top_srcdir)/kaffe/kaffevm/jni \
+	-I$(top_srcdir)/libraries/javalib/external/classpath/native/jni/classpath
 		
 libnanoxawt_la_CFLAGS = \
 	$(CFLAGS_PG) \
@@ -28,7 +29,7 @@
 	-release $(PACKAGE_VERSION) \
 	-export-symbols-regex "^([Jj]ava|kaffe)_"
 
-libnanoxawt_la_LIBADD = $(top_builddir)/kaffe/kaffevm/libkaffevm.la $(AWT_LIBS)
+libnanoxawt_la_LIBADD = $(top_builddir)/kaffe/kaffevm/libkaffevm.la $(top_builddir)/libraries/javalib/external/classpath/native/jni/classpath/libclasspath.la $(AWT_LIBS)
 
 libnanoxawt_la_SOURCES = \
 	awt_const.h  \
Index: kaffe/libraries/clib/awt/nano-X/Makefile.in
diff -u kaffe/libraries/clib/awt/nano-X/Makefile.in:1.35 kaffe/libraries/clib/awt/nano-X/Makefile.in:1.36
--- kaffe/libraries/clib/awt/nano-X/Makefile.in:1.35	Tue Feb  7 21:47:43 2006
+++ kaffe/libraries/clib/awt/nano-X/Makefile.in	Wed Mar  8 21:07:48 2006
@@ -91,6 +91,7 @@
 am__DEPENDENCIES_1 =
 libnanoxawt_la_DEPENDENCIES =  \
 	$(top_builddir)/kaffe/kaffevm/libkaffevm.la \
+	$(top_builddir)/libraries/javalib/external/classpath/native/jni/classpath/libclasspath.la \
 	$(am__DEPENDENCIES_1)
 am_libnanoxawt_la_OBJECTS = libnanoxawt_la-event.lo \
 	libnanoxawt_la-handler.lo libnanoxawt_la-color.lo \
@@ -389,7 +390,8 @@
 native_LTLIBRARIES = libnanoxawt.la
 AM_CPPFLAGS = \
 	-I$(top_builddir)/include \
-	-I$(top_srcdir)/kaffe/kaffevm/jni
+	-I$(top_srcdir)/kaffe/kaffevm/jni \
+	-I$(top_srcdir)/libraries/javalib/external/classpath/native/jni/classpath
 
 libnanoxawt_la_CFLAGS = \
 	$(CFLAGS_PG) \
@@ -402,7 +404,7 @@
 	-release $(PACKAGE_VERSION) \
 	-export-symbols-regex "^([Jj]ava|kaffe)_"
 
-libnanoxawt_la_LIBADD = $(top_builddir)/kaffe/kaffevm/libkaffevm.la $(AWT_LIBS)
+libnanoxawt_la_LIBADD = $(top_builddir)/kaffe/kaffevm/libkaffevm.la $(top_builddir)/libraries/javalib/external/classpath/native/jni/classpath/libclasspath.la $(AWT_LIBS)
 libnanoxawt_la_SOURCES = \
 	awt_const.h  \
 	keymap.h \
Index: kaffe/libraries/clib/awt/nano-X/clipboard.c
diff -u kaffe/libraries/clib/awt/nano-X/clipboard.c:1.1 kaffe/libraries/clib/awt/nano-X/clipboard.c:1.2
--- kaffe/libraries/clib/awt/nano-X/clipboard.c:1.1	Sat Feb  5 17:47:23 2005
+++ kaffe/libraries/clib/awt/nano-X/clipboard.c	Wed Mar  8 21:07:48 2006
@@ -22,6 +22,7 @@
 #include "toolkit.h"
 
 #include "jni.h"
+#include <jcl.h>
 #include <ctype.h>
 
 static jclass     NativeClipboard;
@@ -46,7 +47,7 @@
 	lostOwnership   = (*envP)->GetStaticMethodID( envP, NativeClipboard, "lostOwnership", "()V");
 	createTransferable = (*envP)->GetStaticMethodID( envP, NativeClipboard, "createTransferable", "(Ljava/lang/String;[B)Ljava/awt/datatransfer/Transferable;");
 
-	return (jobject)wid;
+	return JCL_NewRawDataObject (envP, wid);
 }
 
 void
@@ -58,7 +59,7 @@
 		SignalError("java.lang.NullPointerException", "no window object");
 		return;
 	}
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (env, _jwindow);
 	GrDestroyWindow(wid);
 }
 
@@ -72,7 +73,7 @@
 		SignalError("java.lang.NullPointerException", "no window object");
 		return JNI_FALSE;
 	}
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (env, _jwindow);
 
 	GrSetSelectionOwner(wid, MIME0 " " MIME1);
 	
@@ -202,7 +203,7 @@
 		SignalError("java.lang.NullPointerException", "no window object");
 		return NULL;
 	}
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (envP, _jwindow);
 
 	owid = GrGetSelectionOwner(&typelist);
 	if (( owid == NULL ) || ( typelist == NULL )) {
Index: kaffe/libraries/clib/awt/nano-X/event.c
diff -u kaffe/libraries/clib/awt/nano-X/event.c:1.1 kaffe/libraries/clib/awt/nano-X/event.c:1.2
--- kaffe/libraries/clib/awt/nano-X/event.c:1.1	Sat Feb  5 17:47:23 2005
+++ kaffe/libraries/clib/awt/nano-X/event.c	Wed Mar  8 21:07:48 2006
@@ -48,7 +48,7 @@
 {
 	int i;
 
-	i = getSourceIndex((GR_WINDOW_ID)wid);
+	i = getSourceIndex((GR_WINDOW_ID)JCL_GetRawData (env, wid));
 	if ( i < 0 ) {
 		SignalError("java.lang.InternalError", "can't register source");
 		return -1;
@@ -63,7 +63,7 @@
 {
 	int index;
 
-	index = getSourceIndex((GR_WINDOW_ID)_jwindow);
+	index = getSourceIndex((GR_WINDOW_ID)JCL_GetRawData (env, _jwindow));
 
 	if ( index >= 0 ) {
 		nanoX.windowsP[index].wid = 0;
Index: kaffe/libraries/clib/awt/nano-X/font.c
diff -u kaffe/libraries/clib/awt/nano-X/font.c:1.2 kaffe/libraries/clib/awt/nano-X/font.c:1.3
--- kaffe/libraries/clib/awt/nano-X/font.c:1.2	Fri Sep 30 14:55:04 2005
+++ kaffe/libraries/clib/awt/nano-X/font.c	Wed Mar  8 21:07:48 2006
@@ -22,11 +22,12 @@
 #include "toolkit.h"
 
 #include "jni.h"
+#include <jcl.h>
 
 #define getFontName(spec,style) (spec)
 #define getDefaultFontName(style) (spec)
 
-void*
+jobject
 Java_java_awt_Toolkit_fntInitFont( JNIEnv* envP, jclass clazz, jstring jSpec, jint style, jint size )
 {
 	GR_FONT_ID fontid;
@@ -52,21 +53,22 @@
 #else
 	fontid = GrCreateFont(GR_FONT_SYSTEM_VAR, 0, NULL);
 #endif	
-	return (void*)fontid;
+	return JCL_NewRawDataObject(envP, fontid);
 }
 
 void
 Java_java_awt_Toolkit_fntFreeFont ( JNIEnv* env, jclass clazz, jobject _jfont )
 {
-
+        GR_FONT_ID nanoFont = (GR_FONT_ID)JCL_GetRawData(env, _jfont);
+  
 	if ( _jfont == NULL) {
 		SignalError("java.lang.NullPointerException", "no font object");
 		return;
 	}
-	GrDestroyFont((GR_FONT_ID)_jfont);
+	GrDestroyFont(nanoFont);
 }
 
-void*
+jobject
 Java_java_awt_Toolkit_fntInitFontMetrics( JNIEnv* env, jclass clazz, jobject _jfont )
 {
 	return _jfont;
@@ -87,7 +89,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData(env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return fontinfo.maxwidth;
@@ -103,7 +105,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData(env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return fontinfo.height;
@@ -119,7 +121,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData(env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return fontinfo.baseline;
@@ -135,7 +137,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData(env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return fontinfo.height - fontinfo.baseline;
@@ -151,7 +153,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData (env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return fontinfo.baseline;
@@ -167,7 +169,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData (env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return fontinfo.height - fontinfo.baseline;
@@ -203,7 +205,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData (env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	return (fontinfo.lastchar < 256 )?JNI_FALSE:JNI_TRUE;
@@ -231,7 +233,7 @@
 	}
 	len = (*env)->GetStringLength( env, _jstr);
 
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID) JCL_GetRawData (env, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 	w = 0;
 	for( i = 0 ; i < len ; i++ ) {
@@ -261,7 +263,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData (envP, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	widths = (*envP)->NewIntArray(envP, fontinfo.lastchar + 1);
@@ -310,7 +312,7 @@
 		SignalError("java.lang.NullPointerException", "no byte array ");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData (envP, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	n = (*envP)->GetArrayLength(envP, _jbytes);
@@ -348,7 +350,7 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID)JCL_GetRawData (envP, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 
 	if ( fontinfo.lastchar < jChar ) {
@@ -377,7 +379,7 @@
 		SignalError("java.lang.NullPointerException", "no char array object");
 		return 0;
 	}
-	fontid = (GR_FONT_ID)_jfont;
+	fontid = (GR_FONT_ID) JCL_GetRawData (envP, _jfont);
 	GrGetFontInfo(fontid,&fontinfo);
 	
 	n = (*envP)->GetArrayLength( envP, _jchars);
Index: kaffe/libraries/clib/awt/nano-X/graphics.c
diff -u kaffe/libraries/clib/awt/nano-X/graphics.c:1.1 kaffe/libraries/clib/awt/nano-X/graphics.c:1.2
--- kaffe/libraries/clib/awt/nano-X/graphics.c:1.1	Sat Feb  5 17:47:23 2005
+++ kaffe/libraries/clib/awt/nano-X/graphics.c	Wed Mar  8 21:07:48 2006
@@ -22,6 +22,7 @@
 #include "toolkit.h"
 
 #include "jni.h"
+#include <jcl.h>
 
 jobject
 Java_java_awt_Toolkit_graInitGraphics(
@@ -40,19 +41,23 @@
 		SignalError("java.lang.NullPointerException", "no object");
 		return NULL;
 	}
-	graphicsP = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	if (_jgraphics != NULL)
+	  graphicsP = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
+	else
+	  graphicsP = NULL;
+
 	if ( _jtarget ) {
 		switch ( targetType ) {
 		case TLK_TARGET_TYPE_WINDOW:
-			target = (GR_ID)_jtarget; 
+			target = (GR_ID)JCL_GetRawData (env, _jtarget); 
 			break;
 		case TLK_TARGET_TYPE_IMAGE:
-			target = (GR_ID)_jtarget; 
+			target = (GR_ID)JCL_GetRawData (env, _jtarget); 
 			break;
 		case TLK_TARGET_TYPE_GRAPHICS:
 		{
 			TLKGraphics *indgP;
-			indgP = tlk_get_graphics((TLK_GRAPHICS_ID)_jtarget);
+			indgP = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jtarget));
 			if ( indgP == NULL ) {
 				SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 				return NULL;
@@ -81,7 +86,7 @@
 		graphicsP->magicNo = TLK_GRAPHICS_MAGIC_NO;
 	}
 
-	GrSetGCFont(graphicsP->gc,(GR_FONT_ID)_jfont);
+	GrSetGCFont(graphicsP->gc,(GR_FONT_ID)JCL_GetRawData(env, _jfont));
 
 	graphicsP->off_x = off_x;
 	graphicsP->off_y = off_y;
@@ -95,7 +100,7 @@
 		GrClearWindow(graphicsP->gc, 0);
 	}
 
-	return graphicsP;
+	return JCL_NewRawDataObject (env, graphicsP);
 }
 
 void
@@ -103,7 +108,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -121,7 +126,7 @@
 	TLKGraphics *gp;
 	GR_RECT		clip_rect;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -149,7 +154,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -171,7 +176,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -219,7 +224,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -232,7 +237,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -245,7 +250,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -262,7 +267,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -294,7 +299,7 @@
 		SignalError("java.lang.NullPointerException", "byte array is null");
 		return;
 	}
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -328,7 +333,7 @@
 		SignalError("java.lang.NullPointerException", "char array is null");
 		return;
 	}
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -362,7 +367,7 @@
 		SignalError("java.lang.NullPointerException", "char array is null");
 		return;
 	}
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -388,7 +393,7 @@
 	if ((width < 0) || (height < 0)) {
 		return;
 	}
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -405,7 +410,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -423,7 +428,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -438,7 +443,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -453,7 +458,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -468,7 +473,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -517,7 +522,7 @@
 	jboolean isCopy, needConnect;
 	GR_POINT *xyp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -574,7 +579,7 @@
 	jboolean isCopy;
 	GR_POINT *xyp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -625,7 +630,7 @@
 	jboolean isCopy;
 	GR_POINT *xyp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (envP, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -674,7 +679,7 @@
 	TLKGraphics *gp;
 	int x1, x2, y1, y2, a, b;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -715,7 +720,7 @@
 	TLKGraphics *gp;
 	int x1, x2, y1, y2, a, b;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -757,7 +762,7 @@
 	/* not implemented yet */
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -768,7 +773,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -783,7 +788,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 	}
@@ -800,7 +805,7 @@
 	TLKGraphics *gp;
 	jint set_color;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -822,7 +827,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -841,13 +846,13 @@
 		SignalError("java.lang.NullPointerException", "no font object");
 		return;
 	}
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
 	}
 
-	GrSetGCFont(gp->gc, (GR_FONT_ID)_jfont);
+	GrSetGCFont(gp->gc, (GR_FONT_ID)JCL_GetRawData (env, _jfont));
 }
 
 void
@@ -855,7 +860,7 @@
 {
 	TLKGraphics *gp;
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
@@ -875,12 +880,12 @@
 		return;
 	}
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
 	}
-	image = (GR_WINDOW_ID)_jimage;
+	image = (GR_WINDOW_ID)JCL_GetRawData (env, _jimage);
 
 	GrSetGCForeground(gp->gc, native_bg_color);
 	GrFillRect(gp->target, gp->gc, gp->off_x + grX , gp->off_y + grY, width, height);
@@ -910,7 +915,7 @@
 		return;
 	}
 	
-	gp = tlk_get_graphics((TLK_GRAPHICS_ID)_jgraphics);
+	gp = tlk_get_graphics((TLK_GRAPHICS_ID)JCL_GetRawData (env, _jgraphics));
 	if ( gp == NULL ) {
 		SignalError("java.lang.InternalError", "illegal TLK_GRAPHICS_ID");
 		return;
Index: kaffe/libraries/clib/awt/nano-X/image.c
diff -u kaffe/libraries/clib/awt/nano-X/image.c:1.1 kaffe/libraries/clib/awt/nano-X/image.c:1.2
--- kaffe/libraries/clib/awt/nano-X/image.c:1.1	Sat Feb  5 17:47:24 2005
+++ kaffe/libraries/clib/awt/nano-X/image.c	Wed Mar  8 21:07:48 2006
@@ -30,7 +30,7 @@
 
 	image = GrNewPixmap( width, height, 0);
 
-	return (jobject)image;
+	return (jobject)JCL_NewRawDataObject (env, image);
 }
 
 jobject
@@ -40,7 +40,7 @@
 
 	image = GrNewPixmap( width, height, 0);
 
-	return (jobject)image;
+	return (jobject)JCL_NewRawDataObject (env, image);
 }
 
 void
@@ -69,7 +69,7 @@
 	}
 
 	gc = GrNewGC();
-	image = (GR_WINDOW_ID)_jimage;
+	image = (GR_WINDOW_ID)JCL_GetRawData (envP, _jimage);
 	i0 = y * scan + off;
 	for ( yi = y; yi < (y + h); yi++, i0 +=scan) {
 		i = i0;
@@ -98,7 +98,7 @@
 		SignalError("java.lang.NullPointerException", "no object");
 		return;
 	}
-	image = (GR_WINDOW_ID)_jimage;
+	image = (GR_WINDOW_ID)JCL_GetRawData (envP, _jimage);
 
 	GrDestroyWindow(image);
 }
@@ -186,7 +186,7 @@
 	GrDestroyGC(gc);
 	GrFreeImage(native_image);
 
-	return (jobject)image;
+	return (jobject)JLC_GetRawData (envP, image);
 }
 
 jobject
@@ -211,7 +211,7 @@
 		SignalError("java.lang.NullPointerException", "no object");
 		return -1;
 	}
-	image = (GR_WINDOW_ID)_jimage;
+	image = (GR_WINDOW_ID)JCL_GetRawData (env, _jimage);
 
 	GrGetWindowInfo(image, &image_info);
 
@@ -228,7 +228,7 @@
 		SignalError("java.lang.NullPointerException", "no object");
 		return -1;
 	}
-	image = (GR_WINDOW_ID)_jimage;
+	image = (GR_WINDOW_ID)JCL_GetRawData (env, _jimage);
 
 	GrGetWindowInfo(image, &image_info);
 
@@ -276,7 +276,7 @@
 		SignalError("java.lang.NullPointerException", "no object");
 		return;
 	}
-	image = (GR_WINDOW_ID)_jimage;
+	image = (GR_WINDOW_ID)JCL_GetRawData (envP, _jimage);
 
 	if ( modelClazz == NULL ) {
 		modelClazz = (*envP)->FindClass( envP, "kaffe/awt/JavaColorModel");
Index: kaffe/libraries/clib/awt/nano-X/window.c
diff -u kaffe/libraries/clib/awt/nano-X/window.c:1.1 kaffe/libraries/clib/awt/nano-X/window.c:1.2
--- kaffe/libraries/clib/awt/nano-X/window.c:1.1	Sat Feb  5 17:47:24 2005
+++ kaffe/libraries/clib/awt/nano-X/window.c	Wed Mar  8 21:07:48 2006
@@ -67,14 +67,14 @@
 
 	TLK_GrSetReizable(wid, isResizable, x, y, width, height);
 	//printf("create 0x%x %d %d %d %d\n",wid,x,y,width,height);
-	return (jobject)wid;
+	return JCL_NewRawDataObject (env, wid);
 }
 
 void
 Java_java_awt_Toolkit_wndSetResizable( JNIEnv* env, jclass clazz, jobject _jwindow, jboolean isResizable, int x, int y, int width, int height )
 {
 	// NIY
-	TLK_GrSetReizable(wid, isResizable, x, y, width, height);
+	TLK_GrSetReizable(JCL_GetRawData(env, wid), isResizable, x, y, width, height);
 }
 
 void
@@ -83,7 +83,7 @@
 	GR_WINDOW_ID wid;
 	int index;
 
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (envP, _jwindow);
 	index = getSourceIndex(wid);
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");
@@ -108,7 +108,7 @@
 	GR_WINDOW_ID wid;
 
 	index = getSourceIndex((GR_WINDOW_ID)_jwindow);
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (env, _jwindow);
 	if (( index < 0 ) || (nanoX.windowsP[index].flags & TLK_SOURCE_DESTROYED)) {
 #ifdef DEBUG
 		SignalError("java.lang.InternalError", "now, debug!!");
@@ -139,7 +139,7 @@
 		SignalError("java.lang.NullPointerException", "no string object");
 		return;
 	}
-	index = getSourceIndex((GR_WINDOW_ID)_jwindow);
+	index = getSourceIndex((GR_WINDOW_ID)JCL_GetRawData (envP, _jwindow));
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");
 	}
@@ -156,11 +156,12 @@
 Java_java_awt_Toolkit_wndCreateWindow(JNIEnv* envP, jclass clazz, jobject _jowner_wid, jint x, jint y, jint width, jint height, jint jCursor, jint nativeBgColor )
 {
 	GR_WINDOW_ID wid, owner;
-	if ( getSourceIndex((GR_WINDOW_ID)_jowner_wid) < 0 ) {
+	
+	owner = (GR_WINDOW_ID)JCL_GetRawData (envP, _jowner_wid);
+	if ( getSourceIndex(owner) < 0 ) {
 		SignalError("java.lang.InternalError", "illegal owner window id");
 		return 0;
 	}
-	owner = (GR_WINDOW_ID)_jowner_wid;
 
 	wid = GrNewWindow(owner, x, y,
 			width, height, 0, 
@@ -172,18 +173,19 @@
 	}
 	TLK_GrSetReizable(wid, JNI_TRUE, x, y, width, height) 
 
-	return (jobject)wid;
+	return JCL_NewRawDataObject (envP, wid);
 }
 
 jobject
 Java_java_awt_Toolkit_wndCreateDialog(JNIEnv* envP, jclass clazz, jobject _jowner_wid, jint x, jint y, jint width, jint height, jint jCursor, jint nativeBgColor, jboolean isReisizable )
 {
 	GR_WINDOW_ID wid, owner;
-	if ( getSourceIndex((GR_WINDOW_ID)_jowner_wid) < 0 ) {
+
+	owner = (GR_WINDOW_ID)JCL_GetRawData (envP, _jowner_wid);
+	if ( getSourceIndex(owner) < 0 ) {
 		SignalError("java.lang.InternalError", "illegal owner window id");
 		return 0;
 	}
-	owner = (GR_WINDOW_ID)_jowner_wid;
 
 	wid = GrNewWindow(owner, x, y,
 			width, height, 0, 
@@ -195,7 +197,7 @@
 	}
 	TLK_GrSetReizable(wid, isResizable, x, y, width, height) 
 
-	return (jobject)wid;
+	return JCL_NewRawDataObject (envP, wid);
 }
 
 void
@@ -204,7 +206,7 @@
 	GR_WINDOW_ID wid;
 	int index;
 
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (envP, _jwindow);
 	index = getSourceIndex(wid);
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");
@@ -227,7 +229,7 @@
 	GR_WINDOW_ID wid;
 	int index;
 
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (env, _jwindow);
 	index = getSourceIndex(wid);
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");
@@ -253,7 +255,7 @@
 	GR_WINDOW_ID wid;
 	int index;
 
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (envP, _jwindow);
 	index = getSourceIndex(wid);
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");
@@ -274,7 +276,7 @@
 	GR_WINDOW_ID wid;
 	int index;
 
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (env, _jwindow);
 	index = getSourceIndex(wid);
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");
@@ -290,7 +292,7 @@
 	GR_WINDOW_ID wid;
 	int index;
 
-	wid = (GR_WINDOW_ID)_jwindow;
+	wid = (GR_WINDOW_ID)JCL_GetRawData (env, _jwindow);
 	index = getSourceIndex(wid);
 	if ( index < 0 ) {
 		SignalError("java.lang.InternalError", "illegal window id");




More information about the kaffe mailing list