[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: jawt fixes
Kaffe CVS
cvs-commits at kaffe.org
Sun Aug 21 11:49:51 PDT 2005
PatchSet 6862
Date: 2005/08/21 18:44:09
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: jawt fixes
Members:
ChangeLog:1.4384->1.4385
include/jawt.h:1.2->1.3
include/jawt_md.h:1.2->1.3
libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.3->1.4
libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c:1.3->1.4
libraries/clib/classpath/classpath_jawt.h:1.4->1.5
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4384 kaffe/ChangeLog:1.4385
--- kaffe/ChangeLog:1.4384 Sun Aug 21 18:30:58 2005
+++ kaffe/ChangeLog Sun Aug 21 18:44:09 2005
@@ -2,6 +2,50 @@
Resynced with GNU Classpath.
+ 2005-08-20 Thomas Fitzsimmons <fitzsim at redhat.com>
+
+ * native/jni/gtk-peer/gtk_jawt.c
+ (classpath_jawt_get_default_display): Remove locking.
+ (classpath_jawt_get_visualID): Likewise.
+ (classpath_jawt_get_drawable): Likewise.
+ (classpath_jawt_object_lock): Remove function.
+ (classpath_jawt_object_unlock): Likewise.
+ (classpath_jawt_create_lock): Likewise.
+ (classpath_jawt_destroy_lock): Likewise.
+ * native/jni/classpath/classpath_jawt.h
+ (classpath_jawt_object_lock): Remove function.
+ (classpath_jawt_object_unlock): Likewise.
+ (classpath_jawt_create_lock): Likewise.
+ (classpath_jawt_destroy_lock): Likewise.
+ * native/jawt/jawt.c [!__GNUC__] (__attribute__): Define to
+ nothing.
+ (_Jv_Lock): Call classpath_jawt_lock.
+ (_Jv_Unlock): Call classpath_jawt_unlock.
+ (_Jv_GetDrawingSurfaceInfo): Move surface_info_x11 initialization
+ from ...
+ (_Jv_GetDrawingSurface): Remove surface_info_x11 initialization.
+ (_Jv_FreeDrawingSurface): Don't destroy target object.
+ * include/jawt_md.h (struct _JAWT_X11DrawingSurfaceInfo): Re-order
+ display field. Add colour map, depth and GetAWTColor function
+ pointer fields.
+ * include/jawt.h (struct _JAWT_Rectangle): New structure.
+ (struct _JAWT_DrawingSurfaceInfo): Add drawing surface, bounds,
+ clip size and clipping rectangle fields.
+ (struct _JAWT_DrawingSurface): Add env field. Rename lock field
+ target. Re-order function pointer and lock fields. Remove
+ surface_info field.
+ (struct _JAWT): Add GetComponent function pointer field.
+
+ 2005-08-19 Thomas Fitzsimmons <fitzsim at redhat.com>
+
+ * include/jawt.h: Import from libgcj.
+ * include/jawt_md.h: Likewise.
+ * native/jawt/jawt.c: Import from libgcj.
+
+2005-08-21 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-08-19 Lillian Angel <langel at redhat.com>
* javax/swing/tree/DefaultTreeModel.java
Index: kaffe/include/jawt.h
diff -u kaffe/include/jawt.h:1.2 kaffe/include/jawt.h:1.3
--- kaffe/include/jawt.h:1.2 Mon Jul 4 00:03:57 2005
+++ kaffe/include/jawt.h Sun Aug 21 18:44:11 2005
@@ -57,36 +57,44 @@
#define JAWT_LOCK_BOUNDS_CHANGED 0x4
#define JAWT_LOCK_SURFACE_CHANGED 0x8
+struct _JAWT_Rectangle
+{
+ jint x;
+ jint y;
+ jint width;
+ jint height;
+};
+
struct _JAWT_DrawingSurfaceInfo
{
void* platformInfo;
+ struct _JAWT_DrawingSurface *ds;
+ struct _JAWT_Rectangle bounds;
+ jint clipSize;
+ struct _JAWT_Rectangle *clip;
};
struct _JAWT_DrawingSurface
{
+ JNIEnv* env;
+ jobject target;
jint (JNICALL* Lock) (struct _JAWT_DrawingSurface*);
- void (JNICALL* Unlock) (struct _JAWT_DrawingSurface*);
-
struct _JAWT_DrawingSurfaceInfo* (JNICALL* GetDrawingSurfaceInfo) (struct _JAWT_DrawingSurface*);
void (JNICALL* FreeDrawingSurfaceInfo) (struct _JAWT_DrawingSurfaceInfo*);
-
- struct _JAWT_DrawingSurfaceInfo* surface_info;
-
- /* FIXME: also include bounding rectangle of drawing surface. */
- /* FIXME: also include current clipping region. */
+ void (JNICALL* Unlock) (struct _JAWT_DrawingSurface*);
};
struct _JAWT
{
- void (JNICALL *Lock) (JNIEnv*);
- void (JNICALL *Unlock) (JNIEnv*);
-
+ jint version;
struct _JAWT_DrawingSurface* (JNICALL* GetDrawingSurface) (JNIEnv*, jobject);
void (JNICALL* FreeDrawingSurface) (struct _JAWT_DrawingSurface*);
-
- jint version;
+ void (JNICALL *Lock) (JNIEnv*);
+ void (JNICALL *Unlock) (JNIEnv*);
+ jobject (JNICALL *GetComponent)(JNIEnv*, void*);
};
+typedef struct _JAWT_Rectangle JAWT_Rectangle;
typedef struct _JAWT_DrawingSurfaceInfo JAWT_DrawingSurfaceInfo;
typedef struct _JAWT_DrawingSurface JAWT_DrawingSurface;
typedef struct _JAWT JAWT;
Index: kaffe/include/jawt_md.h
diff -u kaffe/include/jawt_md.h:1.2 kaffe/include/jawt_md.h:1.3
--- kaffe/include/jawt_md.h:1.2 Mon Jul 4 00:03:57 2005
+++ kaffe/include/jawt_md.h Sun Aug 21 18:44:11 2005
@@ -50,9 +50,12 @@
struct _JAWT_X11DrawingSurfaceInfo
{
- Display* display;
Drawable drawable;
+ Display* display;
VisualID visualID;
+ Colormap colormapID;
+ int depth;
+ int (JNICALL *GetAWTColor)(struct _JAWT_DrawingSurface*, int, int, int);
};
typedef struct _JAWT_X11DrawingSurfaceInfo JAWT_X11DrawingSurfaceInfo;
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c:1.3 Wed Aug 10 11:37:47 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtk_jawt.c Sun Aug 21 18:44:14 2005
@@ -47,6 +47,8 @@
return CLASSPATH_JAWT_VERSION;
}
+/* Does not require locking: meant to be called after the drawing
+ surface is locked. */
Display*
classpath_jawt_get_default_display (JNIEnv* env, jobject canvas)
{
@@ -69,8 +71,6 @@
ptr = NSA_GET_PTR (env, peer);
- gdk_threads_enter ();
-
widget = GTK_WIDGET (ptr);
/* widget should be realized before Canvas.paint is called. */
@@ -80,11 +80,11 @@
xdisplay = GDK_DISPLAY_XDISPLAY (display);
- gdk_threads_leave ();
-
return xdisplay;
}
+/* Does not require locking: meant to be called after the drawing
+ surface is locked. */
VisualID
classpath_jawt_get_visualID (JNIEnv* env, jobject canvas)
{
@@ -105,8 +105,6 @@
ptr = NSA_GET_PTR (env, peer);
- gdk_threads_enter ();
-
widget = GTK_WIDGET (ptr);
g_assert (GTK_WIDGET_REALIZED (widget));
@@ -114,11 +112,11 @@
visual = gdk_x11_visual_get_xvisual (gtk_widget_get_visual (widget));
g_assert (visual != NULL);
- gdk_threads_leave ();
-
return visual->visualid;
}
+/* Does not require locking: meant to be called after the drawing
+ surface is locked. */
Drawable
classpath_jawt_get_drawable (JNIEnv* env, jobject canvas)
{
@@ -139,35 +137,16 @@
ptr = NSA_GET_PTR (env, peer);
- gdk_threads_enter ();
-
widget = GTK_WIDGET (ptr);
g_assert (GTK_WIDGET_REALIZED (widget));
drawable = GDK_DRAWABLE_XID (widget->window);
- gdk_threads_leave ();
-
return drawable;
}
jint
-classpath_jawt_object_lock (jobject lock)
-{
- JNIEnv *env = cp_gtk_gdk_env();
- (*env)->MonitorEnter (env, lock);
- return 0;
-}
-
-void
-classpath_jawt_object_unlock (jobject lock)
-{
- JNIEnv *env = cp_gtk_gdk_env();
- (*env)->MonitorExit (env, lock);
-}
-
-jint
classpath_jawt_lock ()
{
gdk_threads_enter ();
@@ -178,20 +157,4 @@
classpath_jawt_unlock ()
{
gdk_threads_leave ();
-}
-
-jobject
-classpath_jawt_create_lock ()
-{
- JNIEnv *env = cp_gtk_gdk_env ();
- jobject lock = (*env)->NewStringUTF (env, "jawt-lock");
- NSA_SET_GLOBAL_REF (env, lock);
- return lock;
-}
-
-void
-classpath_jawt_destroy_lock (jobject lock)
-{
- JNIEnv *env = cp_gtk_gdk_env ();
- NSA_DEL_GLOBAL_REF (env, lock);
}
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c:1.3 Sat Aug 13 23:37:22 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/jawt.c Sun Aug 21 18:44:14 2005
@@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -35,14 +35,15 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+#include <stdlib.h>
#include <jni.h>
#include <jawt.h>
#include <jawt_md.h>
-#include <stdlib.h>
#include "classpath_jawt.h"
-#include "native.h"
-/* JAWT_DrawingSurface function declarations */
+#ifndef __GNUC__
+#define __attribute__(x) /* nothing */
+#endif
static jint (JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface);
static void (JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface);
@@ -50,17 +51,14 @@
(JAWT_DrawingSurface* surface);
static void (JNICALL _Jv_FreeDrawingSurfaceInfo)
(JAWT_DrawingSurfaceInfo* surface_info);
-
-/* JAWT function declarations */
-
static JAWT_DrawingSurface* (JNICALL _Jv_GetDrawingSurface) (JNIEnv* env,
jobject canvas);
static void (JNICALL _Jv_FreeDrawingSurface) (JAWT_DrawingSurface* surface);
-static void (JNICALL _Jv_JAWT_Lock) (JNIEnv*);
-static void (JNICALL _Jv_JAWT_Unlock) (JNIEnv*);
+static void (JNICALL _Jv_AWTLock) (JNIEnv*);
+static void (JNICALL _Jv_AWTUnlock) (JNIEnv*);
JNIEXPORT jboolean JNICALL
-JAWT_GetAWT (JNIEnv* env UNUSED, JAWT* awt)
+JAWT_GetAWT (JNIEnv* env __attribute__((unused)), JAWT* awt)
{
jint retrieved_version;
@@ -71,8 +69,8 @@
awt->GetDrawingSurface = _Jv_GetDrawingSurface;
awt->FreeDrawingSurface = _Jv_FreeDrawingSurface;
- awt->Lock = _Jv_JAWT_Lock;
- awt->Unlock = _Jv_JAWT_Unlock;
+ awt->Lock = _Jv_AWTLock;
+ awt->Unlock = _Jv_AWTUnlock;
return JNI_TRUE;
}
@@ -80,14 +78,13 @@
/* JAWT_DrawingSurface functions */
static jint
-(JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface UNUSED)
+(JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface __attribute__((unused)))
{
- /* lock the drawing surface */
return classpath_jawt_lock ();
}
static void
-(JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface UNUSED)
+(JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface __attribute__((unused)))
{
classpath_jawt_unlock ();
}
@@ -95,10 +92,35 @@
static JAWT_DrawingSurfaceInfo*
(JNICALL _Jv_GetDrawingSurfaceInfo) (JAWT_DrawingSurface* surface)
{
- if (surface == NULL)
+ JAWT_DrawingSurfaceInfo* surface_info;
+ JAWT_X11DrawingSurfaceInfo* surface_info_x11;
+
+ if (surface == NULL || surface->target == NULL)
return NULL;
- return surface->surface_info;
+ surface_info = (JAWT_DrawingSurfaceInfo*) malloc (sizeof (JAWT_DrawingSurfaceInfo));
+
+ if (surface_info == NULL)
+ return NULL;
+
+ surface_info->platformInfo = malloc (sizeof (JAWT_X11DrawingSurfaceInfo));
+
+ if (surface_info->platformInfo == NULL)
+ return NULL;
+
+ surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface_info->platformInfo;
+
+ surface_info_x11->display = classpath_jawt_get_default_display (surface->env,
+ surface->target);
+ surface_info_x11->drawable = classpath_jawt_get_drawable (surface->env,
+ surface->target);
+ surface_info_x11->visualID = classpath_jawt_get_visualID (surface->env,
+ surface->target);
+
+ /* FIXME: also include bounding rectangle of drawing surface */
+ /* FIXME: also include current clipping region */
+
+ return surface_info;
}
static void
@@ -115,7 +137,8 @@
surface_info_x11->drawable = 0;
surface_info_x11->visualID = 0;
- KFREE(surface_info);
+ free (surface_info->platformInfo);
+ free (surface_info);
surface_info = NULL;
}
@@ -125,13 +148,15 @@
(JNICALL _Jv_GetDrawingSurface) (JNIEnv* env, jobject canvas)
{
JAWT_DrawingSurface* surface;
- JAWT_X11DrawingSurfaceInfo* surface_info_x11;
- surface = (JAWT_DrawingSurface*) KMALLOC(sizeof (JAWT_DrawingSurface));
+ surface = (JAWT_DrawingSurface*) malloc (sizeof (JAWT_DrawingSurface));
if (surface == NULL)
return NULL;
+ surface->env = env;
+ surface->target = canvas;
+
/* initialize function pointers */
surface->GetDrawingSurfaceInfo = _Jv_GetDrawingSurfaceInfo;
surface->FreeDrawingSurfaceInfo = _Jv_FreeDrawingSurfaceInfo;
@@ -139,42 +164,23 @@
surface->Lock = _Jv_Lock;
surface->Unlock = _Jv_Unlock;
- surface->surface_info = (JAWT_DrawingSurfaceInfo*) KMALLOC(sizeof (JAWT_DrawingSurfaceInfo));
-
- if (surface->surface_info == NULL)
- return NULL;
-
- surface->surface_info->platformInfo = KMALLOC(sizeof (JAWT_X11DrawingSurfaceInfo));
-
- if (surface->surface_info->platformInfo == NULL)
- return NULL;
-
- surface_info_x11 = (JAWT_X11DrawingSurfaceInfo*) surface->surface_info->platformInfo;
-
- surface_info_x11->display = classpath_jawt_get_default_display (env, canvas);
- surface_info_x11->drawable = classpath_jawt_get_drawable (env, canvas);
- surface_info_x11->visualID = classpath_jawt_get_visualID (env, canvas);
-
- /* FIXME: also include bounding rectangle of drawing surface */
- /* FIXME: also include current clipping region */
-
return surface;
}
static void
(JNICALL _Jv_FreeDrawingSurface) (JAWT_DrawingSurface* surface)
{
- KFREE(surface);
+ free (surface);
}
static void
-(JNICALL _Jv_JAWT_Lock) (JNIEnv* env UNUSED)
+(JNICALL _Jv_AWTLock) (JNIEnv* env __attribute__((unused)))
{
classpath_jawt_lock ();
}
static void
-(JNICALL _Jv_JAWT_Unlock) (JNIEnv* env UNUSED)
+(JNICALL _Jv_AWTUnlock) (JNIEnv* env __attribute__((unused)))
{
classpath_jawt_unlock ();
}
Index: kaffe/libraries/clib/classpath/classpath_jawt.h
diff -u kaffe/libraries/clib/classpath/classpath_jawt.h:1.4 kaffe/libraries/clib/classpath/classpath_jawt.h:1.5
--- kaffe/libraries/clib/classpath/classpath_jawt.h:1.4 Wed Aug 10 11:37:47 2005
+++ kaffe/libraries/clib/classpath/classpath_jawt.h Sun Aug 21 18:44:14 2005
@@ -54,11 +54,7 @@
Display* classpath_jawt_get_default_display (JNIEnv* env, jobject canvas);
Drawable classpath_jawt_get_drawable (JNIEnv* env, jobject canvas);
VisualID classpath_jawt_get_visualID (JNIEnv* env, jobject canvas);
-jint classpath_jawt_object_lock (jobject lock);
-void classpath_jawt_object_unlock (jobject lock);
jint classpath_jawt_lock (void);
void classpath_jawt_unlock (void);
-jobject classpath_jawt_create_lock (void);
-void classpath_jawt_destroy_lock (jobject lock);
#endif /* __classpath_jawt_h__ */
More information about the kaffe
mailing list