summaryrefslogtreecommitdiff
path: root/native/jawt
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2005-08-20 22:46:53 +0000
committerThomas Fitzsimmons <fitzsim@redhat.com>2005-08-20 22:46:53 +0000
commit2055eb8823d533e57946ada6f46e2e521ab15746 (patch)
tree2f05e6a13a23bf65bab5a135dc3303ac740479ab /native/jawt
parentc57c525cf50b37d401a193f3f4af1e69774fa90c (diff)
downloadclasspath-2055eb8823d533e57946ada6f46e2e521ab15746.tar.gz
2005-08-20 Thomas Fitzsimmons <fitzsim@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. * native/jawt/Makefile.am: Add SONAME FIXME. * 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.
Diffstat (limited to 'native/jawt')
-rw-r--r--native/jawt/Makefile.am4
-rw-r--r--native/jawt/jawt.c68
2 files changed, 42 insertions, 30 deletions
diff --git a/native/jawt/Makefile.am b/native/jawt/Makefile.am
index dfc64cc60..9caa03d47 100644
--- a/native/jawt/Makefile.am
+++ b/native/jawt/Makefile.am
@@ -2,6 +2,10 @@ pkglib_LTLIBRARIES = libjawtgnu.la
libjawtgnu_la_SOURCES = jawt.c
libjawtgnu_la_LIBADD = $(top_builddir)/native/jni/gtk-peer/libgtkpeer.la
+# FIXME: libtool doesn't allow overriding SONAME, but we need to set
+# it to libjawt.so for binary compatibility.
+#
+# libjawtgnu_la_LDFLAGS = -Wl,-soname -Wl,libjawt.so
AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ -lXtst
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
diff --git a/native/jawt/jawt.c b/native/jawt/jawt.c
index 8efa87cd8..6d26a0da9 100644
--- a/native/jawt/jawt.c
+++ b/native/jawt/jawt.c
@@ -41,6 +41,10 @@
#include <jawt_md.h>
#include "classpath_jawt.h"
+#ifndef __GNUC__
+#define __attribute__(x) /* nothing */
+#endif
+
static jint (JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface);
static void (JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface);
static JAWT_DrawingSurfaceInfo* (JNICALL _Jv_GetDrawingSurfaceInfo)
@@ -74,24 +78,49 @@ JAWT_GetAWT (JNIEnv* env __attribute__((unused)), JAWT* awt)
/* JAWT_DrawingSurface functions */
static jint
-(JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface)
+(JNICALL _Jv_Lock) (JAWT_DrawingSurface* surface __attribute__((unused)))
{
- return classpath_jawt_object_lock (surface->lock);
+ return classpath_jawt_lock ();
}
static void
-(JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface)
+(JNICALL _Jv_Unlock) (JAWT_DrawingSurface* surface __attribute__((unused)))
{
- classpath_jawt_object_unlock (surface->lock);
+ classpath_jawt_unlock ();
}
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;
+
+ surface_info = (JAWT_DrawingSurfaceInfo*) malloc (sizeof (JAWT_DrawingSurfaceInfo));
+
+ if (surface_info == NULL)
return NULL;
- return surface->surface_info;
+ 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
@@ -119,13 +148,15 @@ static JAWT_DrawingSurface*
(JNICALL _Jv_GetDrawingSurface) (JNIEnv* env, jobject canvas)
{
JAWT_DrawingSurface* surface;
- JAWT_X11DrawingSurfaceInfo* surface_info_x11;
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;
@@ -133,34 +164,12 @@ static JAWT_DrawingSurface*
surface->Lock = _Jv_Lock;
surface->Unlock = _Jv_Unlock;
- surface->surface_info = (JAWT_DrawingSurfaceInfo*) malloc (sizeof (JAWT_DrawingSurfaceInfo));
-
- surface->lock = classpath_jawt_create_lock ();
-
- if (surface->surface_info == NULL)
- return NULL;
-
- surface->surface_info->platformInfo = malloc (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)
{
- classpath_jawt_destroy_lock (surface->lock);
free (surface);
}
@@ -175,4 +184,3 @@ static void
{
classpath_jawt_unlock ();
}
-