summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/fdlibm/fdlibm.h2
-rw-r--r--native/jni/classpath/jcl.c4
-rw-r--r--native/jni/classpath/jcl.h2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c6
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c36
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c14
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c7
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c21
-rw-r--r--native/jni/java-net/javanet.h14
-rw-r--r--native/target/generic/target_generic.h2
-rw-r--r--native/target/generic/target_generic_misc.h2
11 files changed, 66 insertions, 44 deletions
diff --git a/native/fdlibm/fdlibm.h b/native/fdlibm/fdlibm.h
index 5dbcdb523..bf9f56991 100644
--- a/native/fdlibm/fdlibm.h
+++ b/native/fdlibm/fdlibm.h
@@ -158,7 +158,7 @@ extern double erfc __P((double));
extern double gamma __P((double));
extern double hypot __P((double, double));
-#if !defined(isnan) && !defined(HAVE_ISNAN)
+#if !defined(isnan)
#define isnan(x) ((x) != (x))
#endif
diff --git a/native/jni/classpath/jcl.c b/native/jni/classpath/jcl.c
index dd6ca06a7..e28c6631b 100644
--- a/native/jni/classpath/jcl.c
+++ b/native/jni/classpath/jcl.c
@@ -68,9 +68,9 @@ JCL_ThrowException (JNIEnv * env, const char *className, const char *errMsg)
if (errExcClass == NULL)
{
fprintf (stderr, "JCL: Utterly failed to throw exeption ");
- fprintf (stderr, className);
+ fprintf (stderr, "%s", className);
fprintf (stderr, " with message ");
- fprintf (stderr, errMsg);
+ fprintf (stderr, "%s", errMsg);
return;
}
}
diff --git a/native/jni/classpath/jcl.h b/native/jni/classpath/jcl.h
index 9a3756238..514b78262 100644
--- a/native/jni/classpath/jcl.h
+++ b/native/jni/classpath/jcl.h
@@ -71,7 +71,7 @@ JNIEXPORT void * JNICALL JCL_GetRawData (JNIEnv * env, jobject rawdata);
/* Simple debug macro */
#ifdef DEBUG
-#define DBG(x) fprintf(stderr, (x));
+#define DBG(x) fprintf(stderr, "%s", (x));
#else
#define DBG(x)
#endif
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 8910bf3ec..0726fb531 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -217,10 +217,10 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector
}
(*env)->ReleaseStringUTFChars (env, chars, str);
-
+
for (i = g_list_first (items); i != NULL; i = g_list_next (i))
- g_free (i->data);
-
+ pango_item_free(i->data);
+
g_list_free (items);
gdk_threads_leave ();
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index d23d7edc6..29bc1855b 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -160,7 +160,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeCopyState
else /* GDK_IS_WINDOW (g->drawable) */
g_object_ref (g->drawable);
- g_object_ref (g->cm);
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
NSA_SET_G_PTR (env, obj, g);
@@ -181,7 +182,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
gdk_rgb_get_visual ()->depth);
g->cm = gdk_rgb_get_colormap ();
- g_object_ref (g->cm);
+
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -208,7 +211,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
g->drawable = (GdkDrawable *)pixmap;
g->cm = gdk_drawable_get_colormap (g->drawable);
- g_object_ref (g->cm);
+
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -235,7 +240,10 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
g_object_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
- g_object_ref (g->cm);
+
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
+
g->gc = gdk_gc_new (g->drawable);
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
color = widget->style->fg[GTK_STATE_NORMAL];
@@ -293,15 +301,17 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeDispose
}
XFlush (GDK_DISPLAY ());
-
- g_object_unref (g->gc);
+
+ if (g->gc != NULL)
+ g_object_unref (g->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
g_object_unref (g->drawable);
- else /* GDK_IS_WINDOW (g->drawable) */
+ else if (g->drawable != NULL)
g_object_unref (g->drawable);
- g_object_unref (g->cm);
+ if (g->cm != NULL)
+ g_object_unref (g->cm);
g_free (g);
@@ -495,7 +505,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
else
{
gdk_gc_get_values (g->gc, &saved);
- gdk_gc_set_foreground (g->gc, &(saved.background));
+ gdk_gc_set_background (g->gc, &(saved.background));
gdk_draw_rectangle (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset, width, height);
gdk_gc_set_foreground (g->gc, &(saved.foreground));
@@ -536,10 +546,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
color.blue = blue << 8;
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
+
+ if (g->cm != NULL)
+ gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
+
gdk_gc_set_foreground (g->gc, &color);
-
+
gdk_threads_leave ();
}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
index ef9ac1207..f44361972 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
@@ -56,3 +56,17 @@ Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
gdk_threads_leave ();
}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_realize (JNIEnv *env, jobject obj)
+{
+ void *ptr;
+
+ gdk_threads_enter ();
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gtk_widget_realize (GTK_WIDGET (ptr));
+
+ gdk_threads_leave ();
+}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index fc6002255..b0d4ab9b0 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -80,7 +80,6 @@ static GtkWidget *get_widget (GtkWidget *widget);
static jmethodID postMouseEventID;
static jmethodID postMouseWheelEventID;
-static jmethodID setCursorID;
static jmethodID postExposeEventID;
static jmethodID postFocusEventID;
@@ -100,9 +99,6 @@ cp_gtk_component_init_jni (void)
"postMouseWheelEvent",
"(IJIIIIZIII)V");
- setCursorID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
- "setCursor", "()V");
-
postExposeEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
"postExposeEvent", "(IIII)V");
@@ -270,6 +266,9 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
gdk_window_set_cursor (widget->window, gdk_cursor);
gdk_cursor_unref (gdk_cursor);
+
+ /* Make sure the cursor is replaced on screen. */
+ gdk_flush();
}
JNIEXPORT void JNICALL
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index a3cea8c4a..1c858faf5 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -1424,6 +1424,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
void *ptr;
+ gint current_width;
+ gint current_height;
ptr = NSA_GET_PTR (env, obj);
@@ -1447,12 +1449,19 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
if (GTK_WIDGET (ptr)->window != NULL)
gdk_window_move (GTK_WIDGET (ptr)->window, x, y);
- /* Need to change the widget's request size. */
- gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
- /* Also need to call gtk_window_resize. If the resize is requested
- by the program and the window's "resizable" property is true then
- the size request will not be honoured. */
- gtk_window_resize (GTK_WINDOW (ptr), width, height);
+ /* Only request resizing if the actual width or height change, otherwise
+ * we get unnecessary flickers because resizing causes GTK to clear the
+ * window content, even if the actual size doesn't change. */
+ gtk_window_get_size(GTK_WINDOW(ptr), &current_width, &current_height);
+ if (current_width != width || current_height != height)
+ {
+ /* Need to change the widget's request size. */
+ gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
+ /* Also need to call gtk_window_resize. If the resize is requested
+ by the program and the window's "resizable" property is true then
+ the size request will not be honoured. */
+ gtk_window_resize (GTK_WINDOW (ptr), width, height);
+ }
}
static void
diff --git a/native/jni/java-net/javanet.h b/native/jni/java-net/javanet.h
index 785b0b082..030d41282 100644
--- a/native/jni/java-net/javanet.h
+++ b/native/jni/java-net/javanet.h
@@ -40,6 +40,7 @@ exception statement from your version. */
#define _JAVANET_LOADED
#include <jni.h>
+#include "jcl.h"
/*************************************************************************/
@@ -73,19 +74,6 @@ exception statement from your version. */
/*************************************************************************/
/*
- * Macros
- */
-
-/* Simple debug macro */
-#ifdef DEBUG
-#define DBG(x) fprintf(stderr, (x));
-#else
-#define DBG(x)
-#endif
-
-/*************************************************************************/
-
-/*
* Function Prototypes
*/
diff --git a/native/target/generic/target_generic.h b/native/target/generic/target_generic.h
index e4ddf5c3b..c2264330d 100644
--- a/native/target/generic/target_generic.h
+++ b/native/target/generic/target_generic.h
@@ -148,7 +148,7 @@ Systems : all
#include <errno.h>
#define TARGET_NATIVE_LAST_ERROR_STRING_FORMAT(buffer,bufferSize,format) \
do { \
- sprintf(buffer,format); \
+ sprintf(buffer, "%s", format); \
strcat(" (error: "); \
strcat(strerror(errno)); \
strcat(")"); \
diff --git a/native/target/generic/target_generic_misc.h b/native/target/generic/target_generic_misc.h
index 1174aa83c..d51be15a8 100644
--- a/native/target/generic/target_generic_misc.h
+++ b/native/target/generic/target_generic_misc.h
@@ -90,7 +90,7 @@ Systems : all
#include <stdarg.h>
#define TARGET_NATIVE_MISC_FORMAT_STRING0(buffer,bufferSize,format) \
do { \
- snprintf(buffer,bufferSize,format); \
+ snprintf(buffer,bufferSize, "%s", format); \
} while (0)
#endif
#ifndef TARGET_NATIVE_MISC_FORMAT_STRING1