aboutsummaryrefslogtreecommitdiff
path: root/libjava/jni/gtk-peer
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/jni/gtk-peer')
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c102
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c498
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c52
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c54
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c73
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c175
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c204
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c180
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c649
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c552
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c92
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c160
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c57
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c381
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c163
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c81
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c120
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c152
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c137
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c93
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c183
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c190
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c209
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c180
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c150
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c87
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c365
-rw-r--r--libjava/jni/gtk-peer/gthread-jni.c169
-rw-r--r--libjava/jni/gtk-peer/gthread-jni.h47
-rw-r--r--libjava/jni/gtk-peer/gtkpeer.h299
30 files changed, 0 insertions, 5854 deletions
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
deleted file mode 100644
index 03c1e4925d7..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* gdkfontmetrics.c
- Copyright (C) 1999, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h"
-#include <gdk/gdkx.h>
-
-#define ASCENT 0
-#define MAX_ASCENT 1
-#define DESCENT 2
-#define MAX_DESCENT 3
-#define MAX_ADVANCE 4
-#define NUM_METRICS 5
-
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_initState
- (JNIEnv *env, jobject obj, jstring fname, jint size)
-{
- jintArray array;
- jint *metrics;
- const char *cfname;
- char *xlfd;
- GdkFont *font;
- XFontStruct *xfont;
-
- cfname = (*env)->GetStringUTFChars (env, fname, NULL);
- xlfd = g_strdup_printf (cfname, (size * 10));
- (*env)->ReleaseStringUTFChars (env, fname, cfname);
-
- array = (*env)->NewIntArray (env, NUM_METRICS);
- metrics = (*env)->GetIntArrayElements (env, array, NULL);
-
- gdk_threads_enter ();
- font = gdk_font_load (xlfd);
- xfont = GDK_FONT_XFONT (font);
-
- metrics[ASCENT] = font->ascent;
- metrics[MAX_ASCENT] = xfont->max_bounds.ascent;
- metrics[DESCENT] = font->descent;
- metrics[MAX_DESCENT] = xfont->max_bounds.descent;
- metrics[MAX_ADVANCE] = xfont->max_bounds.width;
- gdk_threads_leave ();
-
- g_free (xlfd);
- (*env)->ReleaseIntArrayElements (env, array, metrics, 0);
-
- NSA_SET_PTR (env, obj, font);
-
- return array;
-}
-
-JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_stringWidth
- (JNIEnv *env, jobject obj, jstring str)
-{
- GdkFont *font;
- const char *cstr;
- jint width;
-
- font = (GdkFont *) NSA_GET_PTR (env, obj);
- cstr = (*env)->GetStringUTFChars (env, str, NULL);
-
- gdk_threads_enter ();
- width = gdk_string_width (font, cstr);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, str, cstr);
-
- return width;
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
deleted file mode 100644
index 41e9db6b8fa..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/* gdkgraphics.c
- Copyright (C) 1999, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GdkGraphics.h"
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-
-#define GDK_STABLE_IS_PIXMAP(d) (((GdkWindowPrivate *)d)->window_type == GDK_WINDOW_PIXMAP)
-
-GdkPoint *
-translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
- jint npoints, jint x_offset, jint y_offset);
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
- (JNIEnv *env, jobject obj, jobject old)
-{
- struct graphics *g, *g_old;
-
- g = (struct graphics *) malloc (sizeof (struct graphics));
- g_old = (struct graphics *) NSA_GET_PTR (env, old);
-
- *g = *g_old;
-
- gdk_threads_enter ();
-
- g->gc = gdk_gc_new (g->drawable);
- gdk_gc_copy (g->gc, g_old->gc);
-
- if (GDK_STABLE_IS_PIXMAP (g->drawable))
- gdk_pixmap_ref (g->drawable);
- else /* GDK_IS_WINDOW (g->drawable) */
- gdk_window_ref (g->drawable);
-
- gdk_colormap_ref (g->cm);
-
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, g);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
- (JNIEnv *env, jobject obj, jint width, jint height)
-{
- struct graphics *g;
-
- g = (struct graphics *) malloc (sizeof (struct graphics));
- g->x_offset = g->y_offset = 0;
-
- gdk_threads_enter ();
- g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
- gdk_rgb_get_visual ()->depth);
- g->cm = gdk_rgb_get_cmap ();
- gdk_colormap_ref (g->cm);
- g->gc = gdk_gc_new (g->drawable);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, g);
-}
-
-/* copy the native state of the peer (GtkWidget *) to the native state
- of the graphics object */
-JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
- (JNIEnv *env, jobject obj, jobject peer)
-{
- struct graphics *g = (struct graphics *) malloc (sizeof (struct graphics));
- void *ptr;
- GtkWidget *widget;
- GdkColor color;
- jintArray array;
- jint *rgb;
-
- ptr = NSA_GET_PTR (env, peer);
- g->x_offset = g->y_offset = 0;
-
- gdk_threads_enter ();
-
- widget = GTK_WIDGET (ptr);
-
- if (GTK_IS_WINDOW (widget))
- {
- g->drawable = find_gtk_layout (widget)->bin_window;
- }
- else if (GTK_IS_LAYOUT (widget))
- {
- g->drawable = (GdkDrawable *) GTK_LAYOUT (widget)->bin_window;
- }
- else
- {
- g->drawable = (GdkDrawable *) widget->window;
- }
-
- gdk_window_ref (g->drawable);
- g->cm = gtk_widget_get_colormap (widget);
- gdk_colormap_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];
-
- gdk_threads_leave ();
-
- array = (*env)->NewIntArray (env, 3);
- rgb = (*env)->GetIntArrayElements (env, array, NULL);
- rgb[0] = color.red >> 8;
- rgb[1] = color.green >> 8;
- rgb[2] = color.blue >> 8;
- (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
-
- NSA_SET_PTR (env, obj, g);
-
- return array;
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
- (JNIEnv *env, jobject obj)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_DEL_PTR (env, obj);
-
- if (!g) return; /* dispose has been called more than once */
-
- gdk_threads_enter ();
- XFlush (GDK_DISPLAY ());
-
- gdk_gc_destroy (g->gc);
-
- if (GDK_STABLE_IS_PIXMAP (g->drawable))
- gdk_pixmap_unref (g->drawable);
- else /* GDK_IS_WINDOW (g->drawable) */
- gdk_window_unref (g->drawable);
-
- gdk_colormap_unref (g->cm);
-
- gdk_threads_leave ();
-
- free (g);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
- (JNIEnv *env, jobject obj, jint x, jint y)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- g->x_offset += x;
- g->y_offset += y;
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
- (JNIEnv *env, jobject obj, jstring str, jint x, jint y,
- jstring fname, jint size)
-{
- struct graphics *g;
- const char *cfname, *cstr;
- gchar *xlfd;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- cfname = (*env)->GetStringUTFChars (env, fname, NULL);
- xlfd = g_strdup_printf (cfname, (size * 10));
- (*env)->ReleaseStringUTFChars (env, fname, cfname);
-
- cstr = (*env)->GetStringUTFChars (env, str, NULL);
-
- gdk_threads_enter ();
- gdk_draw_string (g->drawable, gdk_font_load (xlfd), g->gc,
- x + g->x_offset, y + g->y_offset, cstr);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, str, cstr);
- g_free (xlfd);
-}
-
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
- (JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_line (g->drawable, g->gc,
- x + g->x_offset, y + g->y_offset,
- x2 + g->x_offset, y2 + g->y_offset);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_rectangle (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset, width, height);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_rectangle (g->drawable, g->gc, FALSE,
- x + g->x_offset, y + g->y_offset, width, height);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
- (JNIEnv *env, jobject obj, jint x, jint y,
- jint width, jint height, jint dx, jint dy)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_window_copy_area ((GdkWindow *)g->drawable,
- g->gc,
- x + g->x_offset + dx, y + g->y_offset + dy,
- (GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset,
- width, height);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap
- (JNIEnv *env, jobject obj, jobject offscreen,
- jint x, jint y, jint width, jint height)
-{
- struct graphics *g1, *g2;
-
- g1 = (struct graphics *) NSA_GET_PTR (env, obj);
- g2 = (struct graphics *) NSA_GET_PTR (env, offscreen);
-
- gdk_threads_enter ();
- gdk_window_copy_area ((GdkWindow *)g1->drawable,
- g1->gc,
- x + g1->x_offset, y + g1->y_offset,
- (GdkWindow *)g2->drawable,
- 0 + g2->x_offset, 0 + g2->y_offset,
- width, height);
- gdk_threads_leave ();
-}
-
-
-
-
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_window_clear_area ((GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset, width, height);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
- (JNIEnv *env, jobject obj, jint func)
-{
- struct graphics *g;
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_gc_set_function (g->gc, func);
- gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
- (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
-{
- GdkColor color;
- struct graphics *g;
-
- color.red = red << 8;
- color.green = green << 8;
- color.blue = blue << 8;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_color_alloc (g->cm, &color);
- gdk_gc_set_foreground (g->gc, &color);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
- jint angle1, jint angle2)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_arc (g->drawable, g->gc, FALSE,
- x + g->x_offset, y + g->y_offset,
- width, height, angle1 << 6, angle2 << 6);
- gdk_threads_leave ();
-}
-
-GdkPoint *
-translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
- jint npoints, jint x_offset, jint y_offset)
-{
- GdkPoint *points;
- jint *x, *y;
- int i;
-
- /* allocate one more point than necessary, in case we need to tack
- on an extra due to the semantics of Java polygons. */
- points = g_malloc (sizeof (GdkPoint) * (npoints + 1));
-
- x = (*env)->GetIntArrayElements (env, xpoints, NULL);
- y = (*env)->GetIntArrayElements (env, ypoints, NULL);
-
- for (i = 0; i < npoints; i++)
- {
- points[i].x = x[i] + x_offset;
- points[i].y = y[i] + y_offset;
- }
-
- (*env)->ReleaseIntArrayElements (env, xpoints, x, JNI_ABORT);
- (*env)->ReleaseIntArrayElements (env, ypoints, y, JNI_ABORT);
-
- return points;
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
- (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
- jint npoints)
-{
- struct graphics *g;
- GdkPoint *points;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
- points = translate_points (env, xpoints, ypoints, npoints,
- g->x_offset, g->y_offset);
-
- gdk_threads_enter ();
- gdk_draw_lines (g->drawable, g->gc, points, npoints);
- gdk_threads_leave ();
-
- g_free (points);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
- (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
- jint npoints)
-{
- struct graphics *g;
- GdkPoint *points;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
- points = translate_points (env, xpoints, ypoints, npoints,
- g->x_offset, g->y_offset);
-
- /* make sure the polygon is closed, per Java semantics.
- if it's not, we close it. */
- if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
- points[npoints++] = points[0];
-
- gdk_threads_enter ();
- gdk_draw_lines (g->drawable, g->gc, points, npoints);
- gdk_threads_leave ();
-
- g_free (points);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
- (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
- jint npoints)
-{
- struct graphics *g;
- GdkPoint *points;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
- points = translate_points (env, xpoints, ypoints, npoints,
- g->x_offset, g->y_offset);
- gdk_threads_enter ();
- gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
- gdk_threads_leave ();
-
- g_free (points);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
- jint angle1, jint angle2)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_arc (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset,
- width, height, angle1 << 6, angle2 << 6);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_arc (g->drawable, g->gc, FALSE,
- x + g->x_offset, y + g->y_offset,
- width, height, 0, 23040);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_draw_arc (g->drawable, g->gc, TRUE,
- x + g->x_offset, y + g->y_offset,
- width, height, 0, 23040);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- struct graphics *g;
- GdkRectangle rectangle;
-
- g = (struct graphics *) NSA_GET_PTR (env, obj);
-
- rectangle.x = x + g->x_offset;
- rectangle.y = y + g->y_offset;
- rectangle.width = width;
- rectangle.height = height;
-
- gdk_threads_enter ();
- gdk_gc_set_clip_rectangle (g->gc, &rectangle);
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
deleted file mode 100644
index ebebc438ae8..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* gtkbuttonpeer.c -- Native implementation of GtkButtonPeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
- (JNIEnv *env, jobject obj)
-{
- gpointer widget;
-
- gdk_threads_enter ();
- widget = gtk_type_new (gtk_button_get_type ());
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
deleted file mode 100644
index cc7cfb8fd30..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* gtkcanvaspeer.c -- Native implementation of GtkCanvasPeer
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkCanvasPeer.h"
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
- (JNIEnv *env, jobject obj)
-{
- gpointer widget;
-
- gdk_threads_enter ();
- widget = gtk_type_new (gtk_drawing_area_get_type ());
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
deleted file mode 100644
index 94b13666776..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
- (JNIEnv *env, jobject obj, jstring label)
-{
- GtkWidget *widget;
- const char *str;
-
- str = (*env)->GetStringUTFChars (env, label, NULL);
-
- gdk_threads_enter ();
- widget = gtk_check_menu_item_new_with_label (str);
- gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), 1);
- gtk_widget_show (widget);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, label, str);
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState
- (JNIEnv *env, jobject obj, jboolean state)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state);
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
deleted file mode 100644
index 09fa7ef21b5..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* gtkcheckboxpeer.c -- Native implementation of GtkCheckboxPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
-
-static void item_toggled (GtkToggleButton *item, jobject peer);
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
- (JNIEnv *env, jobject obj)
-{
- /* The actual underlying widget is owned by a different class. So
- we just clean up the hash table here. */
- NSA_DEL_PTR (env, obj);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
- (JNIEnv *env, jobject obj, jobject checkbox)
-{
- GtkRadioButton *button;
- void *ptr;
- GSList *list;
-
- ptr = NSA_GET_PTR (env, checkbox);
- gdk_threads_enter ();
- button = GTK_RADIO_BUTTON (ptr);
-
- /* Update the group to point to some other widget in the group. We
- have to do this because Gtk doesn't have a separate object to
- represent a radio button's group. */
- for (list = gtk_radio_button_group (button); list != NULL;
- list = list->next)
- {
- if (list->data != button)
- break;
- }
-
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, list ? list->data : NULL);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate
- (JNIEnv *env, jobject obj, jobject group)
-{
- GtkWidget *button;
-
- gdk_threads_enter ();
-
- if (group == NULL)
- button = gtk_check_button_new_with_label ("");
- else
- {
- void *native_group = NSA_GET_PTR (env, group);
- button = gtk_radio_button_new_with_label_from_widget (native_group, "");
- if (native_group == NULL)
- {
- /* Set the native group so we can use the correct value the
- next time around. FIXME: this doesn't work! */
- NSA_SET_PTR (env, group, button);
- }
- }
-
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, button);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr = NSA_GET_PTR (env, obj);
- jobject peer;
-
- gdk_threads_enter ();
-
- peer = (*env)->NewGlobalRef (env, obj);
-
- /* FIXME: when the widget goes away, we should get rid of the global
- reference. */
- gtk_signal_connect (GTK_OBJECT (ptr), "toggled",
- GTK_SIGNAL_FUNC (item_toggled), peer);
-
- gdk_threads_leave ();
-
- /* Connect the superclass hooks. */
- Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks (env, obj);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
- (JNIEnv *env, jobject obj, jobject group)
-{
- GtkRadioButton *button;
- void *native_group, *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- /* FIXME: we can't yet switch between a checkbutton and a
- radiobutton. However, AWT requires this. For now we just
- crash. */
-
- button = GTK_RADIO_BUTTON (ptr);
-
- native_group = NSA_GET_PTR (env, group);
- if (native_group == NULL)
- gtk_radio_button_set_group (button, NULL);
- else
- gtk_radio_button_set_group (button,
- gtk_radio_button_group
- (GTK_RADIO_BUTTON (native_group)));
-
- gdk_threads_leave ();
-
- /* If the native group wasn't set on the new CheckboxGroup, then set
- it now so that the right thing will happen with the next
- radiobutton. The native state for a CheckboxGroup is a pointer
- to one of the widgets in the group. We are careful to keep this
- always pointing at a live widget; whenever a widget is destroyed
- (or otherwise removed from the group), the CheckboxGroup peer is
- notified. */
- if (native_group == NULL)
- NSA_SET_PTR (env, group, native_group);
-}
-
-static void
-item_toggled (GtkToggleButton *item, jobject peer)
-{
- (*gdk_env)->CallVoidMethod (gdk_env, peer,
- postItemEventID,
- peer,
- item->active ?
- (jint) AWT_ITEM_SELECTED :
- (jint) AWT_ITEM_DESELECTED);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
deleted file mode 100644
index b3eee27f4c6..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* gtkchoicepeer.c -- Native implementation of GtkChoicePeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkChoicePeer.h"
-
-static void connect_choice_item_selectable_hook (JNIEnv *env,
- jobject peer_obj,
- GtkItem *item,
- jobject item_obj);
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create
- (JNIEnv *env, jobject obj)
-{
- GtkWidget *menu;
- GtkOptionMenu *option_menu;
- GtkRequisition child_requisition;
-
- gdk_threads_enter ();
- option_menu = GTK_OPTION_MENU (gtk_option_menu_new ());
- menu = gtk_menu_new ();
- gtk_widget_show (menu);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
-
- gtk_widget_size_request (gtk_menu_item_new_with_label (""),
- &child_requisition);
- option_menu->width = child_requisition.width;
- option_menu->height = child_requisition.height;
-
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, option_menu);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkChoicePeer_append
- (JNIEnv *env, jobject obj, jobjectArray items)
-{
- gpointer ptr;
- GtkMenu *menu;
- jsize count, i;
- int need_set_history = 0;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)));
-
- if (!gtk_container_children (GTK_CONTAINER (menu)))
- need_set_history = 1;
-
- count = (*env)->GetArrayLength (env, items);
-
- for (i = 0; i < count; i++)
- {
- jobject item;
- const char *label;
- GtkWidget *menuitem;
-
- item = (*env)->GetObjectArrayElement (env, items, i);
- label = (*env)->GetStringUTFChars (env, item, NULL);
-
- menuitem = gtk_menu_item_new_with_label (label);
-
- (*env)->ReleaseStringUTFChars (env, item, label);
-
- gtk_menu_append (menu, menuitem);
- gtk_widget_show (menuitem);
-
- connect_choice_item_selectable_hook (env, obj,
- GTK_ITEM (menuitem), item);
- }
-
- if (need_set_history)
- gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkChoicePeer_add
- (JNIEnv *env, jobject obj, jstring item, jint index)
-{
- void *ptr;
- const char *label;
- GtkWidget *menu, *menuitem;
- int need_set_history = 0;
-
- ptr = NSA_GET_PTR (env, obj);
-
- label = (*env)->GetStringUTFChars (env, item, 0);
-
- gdk_threads_enter ();
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr));
-
- if (!gtk_container_children (GTK_CONTAINER (menu)))
- need_set_history = 1;
-
- menuitem = gtk_menu_item_new_with_label (label);
- gtk_menu_insert (GTK_MENU (menu), menuitem, index);
- gtk_widget_show (menuitem);
- connect_choice_item_selectable_hook (env, obj, GTK_ITEM (menuitem), item);
-
- if (need_set_history)
- gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0);
-
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, item, label);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkChoicePeer_remove
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
- GtkContainer *menu;
- GList *children;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- menu = GTK_CONTAINER (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)));
- children = gtk_container_children (menu);
- gtk_container_remove (menu, GTK_WIDGET (g_list_nth (children, index)->data));
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), index);
- gdk_threads_leave ();
-}
-
-
-static void
-item_activate (GtkItem *item, struct item_event_hook_info *ie)
-{
- gdk_threads_leave ();
- (*gdk_env)->CallVoidMethod (gdk_env, ie->peer_obj,
- postItemEventID,
- ie->item_obj,
- (jint) AWT_ITEM_SELECTED);
- gdk_threads_enter ();
-}
-
-static void
-connect_choice_item_selectable_hook (JNIEnv *env, jobject peer_obj,
- GtkItem *item, jobject item_obj)
-{
- struct item_event_hook_info *ie;
-
- ie = (struct item_event_hook_info *)
- malloc (sizeof (struct item_event_hook_info));
-
- ie->peer_obj = (*env)->NewGlobalRef (env, peer_obj);
- ie->item_obj = (*env)->NewGlobalRef (env, item_obj);
-
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (item_activate), ie);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
deleted file mode 100644
index 7c6beecf1b1..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* gtkclipboard.c
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkClipboard.h"
-
-jmethodID stringSelectionReceivedID;
-jmethodID stringSelectionHandlerID;
-jmethodID selectionClearID;
-
-void selection_received (GtkWidget *, GtkSelectionData *, guint, gpointer);
-void selection_get (GtkWidget *, GtkSelectionData *, guint, guint, gpointer);
-gint selection_clear (GtkWidget *, GdkEventSelection *);
-
-GtkWidget *clipboard;
-jobject cb_obj;
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env,
- jobject obj)
-{
- if (!stringSelectionReceivedID)
- {
- jclass gtkclipboard;
-
- gtkclipboard = (*env)->FindClass (env,
- "gnu/java/awt/peer/gtk/GtkClipboard");
- stringSelectionReceivedID = (*env)->GetMethodID (env, gtkclipboard,
- "stringSelectionReceived",
- "(Ljava/lang/String;)V");
- stringSelectionHandlerID = (*env)->GetMethodID (env, gtkclipboard,
- "stringSelectionHandler",
- "()Ljava/lang/String;");
- selectionClearID = (*env)->GetMethodID (env, gtkclipboard,
- "selectionClear", "()V");
- }
-
- cb_obj = (*env)->NewGlobalRef (env, obj);
-
- gdk_threads_enter ();
- clipboard = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT(clipboard), "selection_received",
- GTK_SIGNAL_FUNC (selection_received), NULL);
-
- gtk_signal_connect (GTK_OBJECT(clipboard), "selection_clear_event",
- GTK_SIGNAL_FUNC (selection_clear), NULL);
-
- gtk_selection_add_target (clipboard, GDK_SELECTION_PRIMARY,
- GDK_TARGET_STRING, GDK_TARGET_STRING);
-
- gtk_signal_connect (GTK_OBJECT(clipboard), "selection_get",
- GTK_SIGNAL_FUNC (selection_get), NULL);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkClipboard_requestStringConversion (JNIEnv *env,
- jclass clazz)
-{
- gdk_threads_enter ();
- gtk_selection_convert (clipboard, GDK_SELECTION_PRIMARY,
- GDK_TARGET_STRING, GDK_CURRENT_TIME);
- gdk_threads_leave ();
-}
-
-void
-selection_received (GtkWidget *widget, GtkSelectionData *selection_data,
- guint time, gpointer data)
-{
- /* Check to see if retrieval succeeded */
- if (selection_data->length < 0
- || selection_data->type != GDK_SELECTION_TYPE_STRING)
- {
- (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
- NULL);
- }
- else
- {
- char *str = (char *) selection_data->data;
-
- (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
- (*gdk_env)->NewStringUTF (gdk_env, str));
- }
-
- return;
-}
-
-void
-selection_get (GtkWidget *widget,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
-{
- jstring jstr;
- const char *utf;
- jsize utflen;
-
- jstr = (*gdk_env)->CallObjectMethod (gdk_env, cb_obj,
- stringSelectionHandlerID);
-
- if (!jstr)
- {
- gtk_selection_data_set (selection_data,
- GDK_TARGET_STRING, 8, NULL, 0);
- return;
- }
-
- utflen = (*gdk_env)->GetStringUTFLength (gdk_env, jstr);
- utf = (*gdk_env)->GetStringUTFChars (gdk_env, jstr, NULL);
-
- gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8,
- (char *)utf, utflen);
-
- (*gdk_env)->ReleaseStringUTFChars (gdk_env, jstr, utf);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkClipboard_selectionGet (JNIEnv *env,
- jclass clazz)
-{
- GdkWindow *owner;
-
- gdk_threads_enter ();
-
- /* if we already own the clipboard, we need to tell the old data object
- that we're no longer going to be using him */
- owner = gdk_selection_owner_get (GDK_SELECTION_PRIMARY);
- if (owner && owner == clipboard->window)
- (*env)->CallVoidMethod (env, cb_obj, selectionClearID);
-
- gtk_selection_owner_set (clipboard, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
-
- gdk_threads_leave ();
-}
-
-gint
-selection_clear (GtkWidget *widget, GdkEventSelection *event)
-{
- (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, selectionClearID);
-
- return TRUE;
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
deleted file mode 100644
index 5522354e35d..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ /dev/null
@@ -1,649 +0,0 @@
-/* gtkcomponentpeer.c -- Native implementation of GtkComponentPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
-#include <gtk/gtkprivate.h>
-
-#define GTK_OBJECT_SETV(ptr, arg) \
- gdk_threads_enter (); \
- { \
- GtkArgInfo *info = NULL; \
- char *error; \
- \
- error = gtk_object_arg_get_info (GTK_OBJECT_TYPE (ptr), arg.name, &info); \
- if (error) \
- { \
- /* assume the argument is destined for the container's only child */ \
- ptr = gtk_container_children (GTK_CONTAINER (ptr))->data; \
- } \
- gtk_object_setv (GTK_OBJECT (ptr), 1, &arg); \
- } \
- gdk_threads_leave (); \
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_DEL_PTR (env, obj);
-
- /* For now the native state for any object must be a widget.
- However, a subclass could override dispose() if required. */
- gdk_threads_enter ();
- gtk_widget_destroy (GTK_WIDGET (ptr));
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor
- (JNIEnv *env, jobject obj, jint type)
-{
- void *ptr;
- GtkWidget *widget;
- GdkCursorType gdk_cursor_type;
- GdkCursor *gdk_cursor;
-
- ptr = NSA_GET_PTR (env, obj);
-
- switch (type)
- {
- case AWT_CROSSHAIR_CURSOR:
- gdk_cursor_type = GDK_CROSSHAIR;
- break;
- case AWT_TEXT_CURSOR:
- gdk_cursor_type = GDK_XTERM;
- break;
- case AWT_WAIT_CURSOR:
- gdk_cursor_type = GDK_WATCH;
- break;
- case AWT_SW_RESIZE_CURSOR:
- gdk_cursor_type = GDK_BOTTOM_LEFT_CORNER;
- break;
- case AWT_SE_RESIZE_CURSOR:
- gdk_cursor_type = GDK_BOTTOM_RIGHT_CORNER;
- break;
- case AWT_NW_RESIZE_CURSOR:
- gdk_cursor_type = GDK_TOP_LEFT_CORNER;
- break;
- case AWT_NE_RESIZE_CURSOR:
- gdk_cursor_type = GDK_TOP_RIGHT_CORNER;
- break;
- case AWT_N_RESIZE_CURSOR:
- gdk_cursor_type = GDK_TOP_SIDE;
- break;
- case AWT_S_RESIZE_CURSOR:
- gdk_cursor_type = GDK_BOTTOM_SIDE;
- break;
- case AWT_W_RESIZE_CURSOR:
- gdk_cursor_type = GDK_LEFT_SIDE;
- break;
- case AWT_E_RESIZE_CURSOR:
- gdk_cursor_type = GDK_RIGHT_SIDE;
- break;
- case AWT_HAND_CURSOR:
- gdk_cursor_type = GDK_HAND2;
- break;
- case AWT_MOVE_CURSOR:
- gdk_cursor_type = GDK_FLEUR;
- break;
- default:
- gdk_cursor_type = GDK_LEFT_PTR;
- }
-
- gdk_threads_enter ();
-
- widget = GTK_WIDGET(ptr);
-
- gdk_cursor = gdk_cursor_new (gdk_cursor_type);
- gdk_window_set_cursor (widget->window, gdk_cursor);
- gdk_cursor_destroy (gdk_cursor);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_requestFocus
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_grab_focus (GTK_WIDGET (ptr));
- gdk_threads_leave ();
-}
-
-
-/*
- * Show a widget (NO LONGER USED)
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisible
- (JNIEnv *env, jobject obj, jboolean visible)
-{
- GtkWidget *widget;
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- widget = GTK_WIDGET (ptr);
-
- if (visible)
- gtk_widget_show (widget);
- else
- gtk_widget_hide (widget);
-
- gdk_flush ();
- gdk_threads_leave ();
-}
-
-/*
- * Find the origin of a widget's window.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
- (JNIEnv * env, jobject obj, jintArray jpoint)
-{
- void *ptr;
- jint *point;
-
- ptr = NSA_GET_PTR (env, obj);
- point = (*env)->GetIntArrayElements (env, jpoint, 0);
-
- gdk_threads_enter ();
- gdk_window_get_origin (GTK_WIDGET (ptr)->window, point, point+1);
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
-}
-
-/*
- * Find the preferred size of a widget.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions
- (JNIEnv *env, jobject obj, jintArray jdims)
-{
- void *ptr;
- jint *dims;
- GtkRequisition req;
-
- ptr = NSA_GET_PTR (env, obj);
- dims = (*env)->GetIntArrayElements (env, jdims, 0);
-
- gdk_threads_enter ();
-
- gtk_signal_emit_by_name (GTK_OBJECT (ptr), "size_request", &req);
-
- dims[0] = req.width;
- dims[1] = req.height;
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetUsize (JNIEnv *env,
- jobject obj, jint w, jint h)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_set_usize (GTK_WIDGET (ptr), w, h);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedNew (JNIEnv *env,
- jobject obj, jint width, jint height, jboolean visible)
-{
- GtkWidget *layout;
-
- gdk_threads_enter ();
- layout = gtk_layout_new (NULL, NULL);
- gtk_widget_realize (layout);
- connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
- set_visible (layout, visible);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, layout);
-}
-
-/*
- * Place a widget on the layout widget.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedPut
- (JNIEnv *env, jobject obj, jobject container, jint x, jint y)
-{
- GList *child;
- GtkWidget *fix;
- void *containerptr=NULL;
- void *objptr=NULL;
-
- /* We hawe a container which, if it is a window, will have
- this component added to its fixed. If it is a fixed, we add the
- component to it. */
-
- containerptr=NSA_GET_PTR (env, container);
- objptr=NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- if (GTK_IS_WINDOW(GTK_OBJECT(containerptr)))
- {
- child=gtk_container_children (GTK_CONTAINER(containerptr));
-
- while (child && !GTK_IS_FIXED(child->data))
- {
- child=g_list_next(child);
- }
-
- fix=GTK_WIDGET(child->data);
- g_list_free(child);
- }
- else
- if (GTK_IS_SCROLLED_WINDOW(GTK_OBJECT(containerptr)))
- {
- child=gtk_container_children (GTK_CONTAINER (GTK_BIN(containerptr)->child));
-
- while (child && !GTK_IS_FIXED(child->data))
- {
- child=g_list_next(child);
- }
-
- fix=GTK_WIDGET(child->data);
-
- g_list_free(child);
- }
- else
- {
- fix=GTK_WIDGET(containerptr);
- }
-
- gtk_fixed_put(GTK_FIXED(fix),GTK_WIDGET(objptr),x,y);
- gtk_widget_realize (GTK_WIDGET (objptr));
- gtk_widget_show (GTK_WIDGET (objptr));
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedMove (JNIEnv *env,
- jobject obj, jint x, jint y)
-{
- GtkWidget *widget;
- void *ptr=NULL;
-
- /* For some reason, ScrolledWindow tries to scroll its contents
- by moving them using this function. Since we want to use GTK's
- nice fast scrolling, we try to second guess it here. This
- might cause problems later. */
-
- if (x >= 0 && y >= 0)
- {
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- widget=GTK_WIDGET (ptr);
- if (!GTK_IS_WINDOW (widget))
- gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
- gdk_threads_leave ();
- }
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- GtkWidget *widget;
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- widget = GTK_WIDGET (ptr);
- if (GTK_IS_VIEWPORT (widget->parent))
- {
- gtk_widget_set_usize (widget, width, height);
- }
- else
- {
- gtk_widget_set_usize (widget, width, height);
- gtk_layout_move (GTK_LAYOUT (widget->parent), widget, x, y);
- }
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT jintArray JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- jintArray array;
- int *rgb;
- GdkColor bg;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL];
- gdk_threads_leave ();
-
- array = (*env)->NewIntArray (env, 3);
- rgb = (*env)->GetIntArrayElements (env, array, NULL);
- /* convert color data from 16 bit values down to 8 bit values */
- rgb[0] = bg.red >> 8;
- rgb[1] = bg.green >> 8;
- rgb[2] = bg.blue >> 8;
- (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
-
- return array;
-}
-
-JNIEXPORT jintArray JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- jintArray array;
- jint *rgb;
- GdkColor fg;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- fg = GTK_WIDGET (ptr)->style->fg[GTK_STATE_NORMAL];
- gdk_threads_leave ();
-
- array = (*env)->NewIntArray (env, 3);
- rgb = (*env)->GetIntArrayElements (env, array, NULL);
- /* convert color data from 16 bit values down to 8 bit values */
- rgb[0] = fg.red >> 8;
- rgb[1] = fg.green >> 8;
- rgb[2] = fg.blue >> 8;
- (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
-
- return array;
-}
-
-void
-set_visible (GtkWidget *widget, jboolean visible)
-{
- if (visible)
- gtk_widget_show (widget);
- else
- gtk_widget_hide (widget);
-}
-
-GtkLayout *
-find_gtk_layout (GtkWidget *parent)
-{
- if (GTK_IS_WINDOW (parent))
- {
- GList *children = gtk_container_children
- (GTK_CONTAINER (GTK_BIN (parent)->child));
-
- if (GTK_IS_MENU_BAR (children->data))
- return GTK_LAYOUT (children->next->data);
- else /* GTK_IS_LAYOUT (children->data) */
- return GTK_LAYOUT (children->data);
- }
-
- return NULL;
-}
-
-#define WIDGET_CLASS(w) GTK_WIDGET_CLASS (GTK_OBJECT (w)->klass)
-
-void
-set_parent (GtkWidget *widget, GtkContainer *parent)
-{
- if (GTK_IS_WINDOW (parent))
- {
- GList *children = gtk_container_children
- (GTK_CONTAINER (GTK_BIN (parent)->child));
-
- if (GTK_IS_MENU_BAR (children->data))
- gtk_layout_put (GTK_LAYOUT (children->next->data), widget, 0, 0);
- else /* GTK_IS_LAYOUT (children->data) */
- gtk_layout_put (GTK_LAYOUT (children->data), widget, 0, 0);
- }
- else
- if (GTK_IS_SCROLLED_WINDOW (parent))
- {
-/* if (WIDGET_CLASS (widget)->set_scroll_adjustments_signal) */
-/* gtk_container_add (GTK_CONTAINER (parent), widget); */
-/* else */
-/* { */
- gtk_scrolled_window_add_with_viewport
- (GTK_SCROLLED_WINDOW (parent), widget);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent),
- GTK_SHADOW_NONE);
-/* } */
-
- }
-/* gtk_layout_put */
-/* (GTK_LAYOUT (GTK_BIN (parent)->child), widget, 0, 0); */
-
-/* if (GTK_IS_SCROLLED_WINDOW (parent)) */
-/* gtk_layout_put */
-/* (GTK_LAYOUT (GTK_BIN (GTK_BIN (parent)->child)->child), widget, 0, 0); */
- else
- gtk_layout_put (GTK_LAYOUT (parent), widget, 0, 0);
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- jboolean ret_val;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- ret_val = GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (ptr));
- gdk_threads_leave ();
-
- return ret_val;
-}
-
-JNIEXPORT jboolean JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab
- (JNIEnv *env, jclass clazz)
-{
- GtkWidget *widget;
- jboolean retval;
-
- gdk_threads_enter ();
- widget = gtk_grab_get_current ();
- retval = (widget && GTK_IS_WINDOW (widget) && GTK_WINDOW (widget)->modal);
- gdk_threads_leave ();
-
- return retval;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_String_2
- (JNIEnv *env, jobject obj, jstring jname, jstring jvalue)
-{
- const char *name;
- const char *value;
- void *ptr;
- GtkArg arg;
-
- ptr = NSA_GET_PTR (env, obj);
- name = (*env)->GetStringUTFChars (env, jname, NULL);
- value = (*env)->GetStringUTFChars (env, jvalue, NULL);
-
- arg.type = GTK_TYPE_STRING;
- arg.name = (char *) name;
- GTK_VALUE_STRING (arg) = (char *) value;
-
- GTK_OBJECT_SETV (ptr, arg);
-
- (*env)->ReleaseStringUTFChars (env, jname, name);
- (*env)->ReleaseStringUTFChars (env, jvalue, value);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Z
- (JNIEnv *env, jobject obj, jstring jname, jboolean value)
-{
- const char *name;
- void *ptr;
- GtkArg arg;
-
- ptr = NSA_GET_PTR (env, obj);
- name = (*env)->GetStringUTFChars (env, jname, NULL);
-
- arg.type = GTK_TYPE_BOOL;
- arg.name = (char *) name;
- GTK_VALUE_BOOL (arg) = value;
-
- GTK_OBJECT_SETV (ptr, arg);
-
- (*env)->ReleaseStringUTFChars (env, jname, name);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2I
- (JNIEnv *env, jobject obj, jstring jname, jint value)
-{
- const char *name;
- void *ptr;
- GtkArg arg;
-
- ptr = NSA_GET_PTR (env, obj);
- name = (*env)->GetStringUTFChars (env, jname, NULL);
-
- arg.type = GTK_TYPE_INT;
- arg.name = (char *) name;
- GTK_VALUE_INT (arg) = value;
-
- GTK_OBJECT_SETV (ptr, arg);
-
- (*env)->ReleaseStringUTFChars (env, jname, name);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2F
- (JNIEnv *env, jobject obj, jstring jname, jfloat value)
-{
- const char *name;
- void *ptr;
- GtkArg arg;
-
- ptr = NSA_GET_PTR (env, obj);
- name = (*env)->GetStringUTFChars (env, jname, NULL);
-
- arg.type = GTK_TYPE_FLOAT;
- arg.name = (char *) name;
- GTK_VALUE_FLOAT (arg) = value;
-
- GTK_OBJECT_SETV (ptr, arg);
-
- (*env)->ReleaseStringUTFChars (env, jname, name);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_Object_2
- (JNIEnv *env, jobject obj1, jstring jname, jobject obj2)
-{
- const char *name;
- void *ptr1, *ptr2;
- GtkArg arg;
-
- ptr1 = NSA_GET_PTR (env, obj1);
- ptr2 = NSA_GET_PTR (env, obj2);
-
- name = (*env)->GetStringUTFChars (env, jname, NULL);
-
- /* special case to catch where we need to set the parent */
- if (!strcmp (name, "parent"))
- {
- gdk_threads_enter ();
- set_parent (GTK_WIDGET (ptr1), GTK_CONTAINER (ptr2));
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, jname, name);
- return;
- }
-
- arg.type = GTK_TYPE_OBJECT;
- arg.name = (char *) name;
- GTK_VALUE_OBJECT (arg) = GTK_OBJECT (ptr2);
-
- GTK_OBJECT_SETV (ptr1, arg);
-
- (*env)->ReleaseStringUTFChars (env, jname, name);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_create
- (JNIEnv *env, jobject obj, jstring jtypename)
-{
- const char *typename;
- gpointer widget;
-
- typename = (*env)->GetStringUTFChars (env, jtypename, NULL);
-
- gdk_threads_enter ();
- gtk_button_get_type ();
- widget = gtk_object_newv (gtk_type_from_name (typename),
- 0, NULL);
-/* widget = gtk_type_new (gtk_type_from_name (typename)); */
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, jtypename, typename);
- NSA_SET_PTR (env, obj, widget);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
deleted file mode 100644
index 99ca0934c3d..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/* gtkevents.c -- GDK/GTK event handlers
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include <X11/Xlib.h>
-#include <gdk/gdkkeysyms.h>
-#include <stdarg.h>
-#include <assert.h>
-
-/* A widget can be composed of multipled windows, so we need to hook
- events on all of them. */
-struct event_hook_info
-{
- jobject *peer_obj;
- int nwindows;
- GdkWindow ***windows; /* array of pointers to (GdkWindow *) */
-};
-
-static jint
-button_to_awt_mods (int button)
-{
- switch (button)
- {
- case 1:
- return AWT_BUTTON1_MASK;
- case 2:
- return AWT_BUTTON2_MASK;
- case 3:
- return AWT_BUTTON3_MASK;
- }
-
- return 0;
-}
-
-static jint
-state_to_awt_mods (int mods)
-{
- jint result = 0;
-
- if (mods & (GDK_SHIFT_MASK | GDK_LOCK_MASK))
- result |= AWT_SHIFT_MASK;
- if (mods & GDK_CONTROL_MASK)
- result |= AWT_CTRL_MASK;
-
- return result;
-}
-
-#ifdef __GNUC__
-__inline
-#endif
-static jint
-keysym_to_awt_keycode (guint keyval)
-{
- guint vk;
-
- vk = gdk_keyval_to_upper (keyval);
-
- if (vk <= 0x41 && vk <= 0x5A) /* VK_A through VK_Z */
- return vk;
-
- if (vk <= 0x30 && vk <= 39) /* VK_0 through VK_9 */
- return vk;
-
- switch (vk)
- {
- case GDK_Alt_L:
- case GDK_Alt_R:
- return VK_ALT;
- case GDK_BackSpace:
- return VK_BACK_SPACE;
- case GDK_Cancel:
- return VK_CANCEL;
- case GDK_Caps_Lock:
- return VK_CAPS_LOCK;
- case GDK_Clear:
- return VK_CLEAR;
- case GDK_bracketright:
- return VK_CLOSE_BRACKET;
- case GDK_comma:
- return VK_COMMA;
- case GDK_Control_L:
- case GDK_Control_R:
- return VK_CONTROL;
- case GDK_KP_Decimal:
- return VK_DECIMAL;
- case GDK_Delete:
- return VK_DELETE;
- case GDK_KP_Divide:
- return VK_DIVIDE;
- case GDK_Down:
- return VK_DOWN;
- case GDK_End:
- return VK_END;
- case GDK_Return:
- return VK_ENTER;
- case GDK_Escape:
- return VK_ESCAPE;
- case GDK_F1:
- return VK_F1;
- case GDK_F2:
- return VK_F2;
- case GDK_F3:
- return VK_F3;
- case GDK_F4:
- return VK_F4;
- case GDK_F5:
- return VK_F5;
- case GDK_F6:
- return VK_F6;
- case GDK_F7:
- return VK_F7;
- case GDK_F8:
- return VK_F8;
- case GDK_F9:
- return VK_F9;
- case GDK_F10:
- return VK_F10;
- case GDK_F11:
- return VK_F11;
- case GDK_F12:
- return VK_F12;
- case GDK_Help:
- return VK_HELP;
- case GDK_Home:
- return VK_HOME;
- case GDK_Insert:
- return VK_INSERT;
- case GDK_Kanji:
- return VK_KANJI;
- case GDK_Left:
- return VK_LEFT;
- case GDK_Meta_L:
- case GDK_Meta_R:
- return VK_META;
- case GDK_KP_Multiply:
- return VK_MULTIPLY;
- case GDK_Num_Lock:
- return VK_NUM_LOCK;
- case GDK_KP_0:
- return VK_NUMPAD0;
- case GDK_KP_1:
- return VK_NUMPAD1;
- case GDK_KP_2:
- return VK_NUMPAD2;
- case GDK_KP_3:
- return VK_NUMPAD3;
- case GDK_KP_4:
- return VK_NUMPAD4;
- case GDK_KP_5:
- return VK_NUMPAD5;
- case GDK_KP_6:
- return VK_NUMPAD6;
- case GDK_KP_7:
- return VK_NUMPAD7;
- case GDK_KP_8:
- return VK_NUMPAD8;
- case GDK_KP_9:
- return VK_NUMPAD9;
- case GDK_bracketleft:
- return VK_OPEN_BRACKET;
- case GDK_Page_Down:
- return VK_PAGE_DOWN;
- case GDK_Page_Up:
- return VK_PAGE_UP;
- case GDK_Pause:
- return VK_PAUSE;
- case GDK_period:
- return VK_PERIOD;
- case GDK_Print:
- return VK_PRINTSCREEN;
- case GDK_quoteright:
- return VK_QUOTE;
- case GDK_Right:
- return VK_RIGHT;
- case GDK_Scroll_Lock:
- return VK_SCROLL_LOCK;
- case GDK_semicolon:
- return VK_SEMICOLON;
- case GDK_KP_Separator:
- return VK_SEPARATOR;
- case GDK_Shift_L:
- case GDK_Shift_R:
- return VK_SHIFT;
- case GDK_slash:
- return VK_SLASH;
- case GDK_space:
- return VK_SPACE;
- case GDK_KP_Subtract:
- return VK_SUBTRACT;
- case GDK_Tab:
- return VK_TAB;
- case GDK_Up:
- return VK_UP;
-
- default:
- return VK_UNDEFINED;
- }
-}
-
-void
-awt_event_handler (GdkEvent *event)
-{
- jobject *obj_ptr;
- static guint32 button_click_time = 0;
- static GdkWindow *button_window = NULL;
- static guint button_number = -1;
- static jint click_count = 1;
-
- /* keep synthetic AWT events from being processed recursively */
- if (event->type & SYNTHETIC_EVENT_MASK && event->type != GDK_NOTHING)
- {
- event->type ^= SYNTHETIC_EVENT_MASK;
- gtk_main_do_event (event);
- return;
- }
-
- /* keep track of clickCount ourselves, since the AWT allows more
- than a triple click to occur */
- if (event->type == GDK_BUTTON_PRESS)
- {
- if ((event->button.time < (button_click_time + MULTI_CLICK_TIME))
- && (event->button.window == button_window)
- && (event->button.button == button_number))
- click_count++;
- else
- click_count = 1;
-
- button_click_time = event->button.time;
- button_window = event->button.window;
- button_number = event->button.button;
- }
-
- /* for all input events, which have a window with a jobject attached,
- send the input event off to Java before GTK has a chance to process
- the event */
- if ((event->type == GDK_BUTTON_PRESS
- || event->type == GDK_BUTTON_RELEASE
- || event->type == GDK_ENTER_NOTIFY
- || event->type == GDK_LEAVE_NOTIFY
- || event->type == GDK_CONFIGURE
- || event->type == GDK_EXPOSE
- || event->type == GDK_KEY_PRESS
- || event->type == GDK_FOCUS_CHANGE
- || event->type == GDK_MOTION_NOTIFY)
- && gdk_property_get (event->any.window,
- gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE),
- gdk_atom_intern ("CARDINAL", FALSE),
- 0,
- sizeof (jobject),
- FALSE,
- NULL,
- NULL,
- NULL,
- (guchar **)&obj_ptr))
- {
- switch (event->type)
- {
- case GDK_BUTTON_PRESS:
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_PRESSED,
- (jlong)event->button.time,
- state_to_awt_mods (event->button.state) |
- button_to_awt_mods (event->button.button),
- (jint)event->button.x,
- (jint)event->button.y,
- click_count,
- (event->button.button == 3) ? JNI_TRUE :
- JNI_FALSE);
-
- /* grab_counter++;
- gdk_pointer_grab (event->any.window,
- FALSE,
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK,
- NULL,
- NULL,
- event->button.time);*/
- break;
- case GDK_BUTTON_RELEASE:
- {
- int width, height;
-
- /* only ungrab if no other buttons are pressed down */
- /* if (--grab_counter == 0)
- gdk_pointer_ungrab (event->button.time);
- */
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_RELEASED,
- (jlong)event->button.time,
- state_to_awt_mods (event->button.state) |
- button_to_awt_mods (event->button.button),
- (jint)event->button.x,
- (jint)event->button.y,
- click_count, JNI_FALSE);
-
- /* check to see if the release occured in the window it was pressed
- in, and if so, generate an AWT click event */
- gdk_window_get_size (event->any.window, &width, &height);
- if (event->button.x >= 0
- && event->button.y >= 0
- && event->button.x <= width
- && event->button.y <= height)
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_CLICKED,
- (jlong)event->button.time,
- state_to_awt_mods (event->button.state) |
- button_to_awt_mods (event->button.button),
- (jint)event->button.x,
- (jint)event->button.y,
- click_count, JNI_FALSE);
-
- }
- break;
- case GDK_MOTION_NOTIFY:
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_MOVED,
- (jlong)event->motion.time,
- state_to_awt_mods (event->motion.state),
- (jint)event->motion.x,
- (jint)event->motion.y,
- 0, JNI_FALSE);
-
- if (event->motion.state & (GDK_BUTTON1_MASK
- | GDK_BUTTON2_MASK
- | GDK_BUTTON3_MASK
- | GDK_BUTTON4_MASK
- | GDK_BUTTON5_MASK))
- {
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_DRAGGED,
- (jlong)event->motion.time,
- state_to_awt_mods (event->motion.state),
- (jint)event->motion.x,
- (jint)event->motion.y,
- 0, JNI_FALSE);
- }
- break;
- case GDK_ENTER_NOTIFY:
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_ENTERED,
- (jlong)event->crossing.time,
- state_to_awt_mods (event->crossing.state),
- (jint)event->crossing.x,
- (jint)event->crossing.y,
- 0, JNI_FALSE);
- break;
- case GDK_LEAVE_NOTIFY:
- if (event->crossing.mode == GDK_CROSSING_NORMAL)
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
- AWT_MOUSE_EXITED,
- (jlong)event->crossing.time,
- state_to_awt_mods (event->crossing.state),
- (jint)event->crossing.x,
- (jint)event->crossing.y,
- 0, JNI_FALSE);
- break;
- case GDK_CONFIGURE:
- {
- GtkWidget *widget;
-
- gdk_window_get_user_data (event->any.window, (void **) &widget);
-
- if (widget && GTK_WIDGET_TOPLEVEL (widget))
- {
- gint top, left, right, bottom;
- gint x, y, w, h, wb, d;
-
- /* calculate our insets */
- gdk_window_get_root_geometry (event->any.window,
- &x, &y, &w, &h, &wb, &d);
-
- /* We used to compute these based on the configure
- event's fields. However, that gives strange and
- apparently incorrect results. */
- top = left = bottom = right = 0;
-
- /* configure events are not posted to the AWT event queue,
- and as such, gdk/gtk will be called back before
- postConfigureEvent returns */
- gdk_threads_leave ();
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
- postConfigureEventID,
- (jint)event->configure.x,
- (jint)event->configure.y,
- (jint)event->configure.width,
- (jint)event->configure.height,
- (jint)top,
- (jint)left,
- (jint)bottom,
- (jint)right);
- gdk_threads_enter ();
- }
- }
- break;
- case GDK_EXPOSE:
- {
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
- postExposeEventID,
- (jint)event->expose.area.x,
- (jint)event->expose.area.y,
- (jint)event->expose.area.width,
- (jint)event->expose.area.height);
- }
- break;
-
- case GDK_KEY_PRESS:
- {
- GtkWidget *widget;
- GtkWindow *window;
-
- gdk_window_get_user_data (event->any.window, (void **) &widget);
-
- window = GTK_WINDOW (gtk_widget_get_ancestor (widget,
- GTK_TYPE_WINDOW));
- if (window
- && GTK_WIDGET_IS_SENSITIVE (window)
- && window->focus_widget
- && GTK_WIDGET_IS_SENSITIVE (window->focus_widget)
- && window->focus_widget->window)
- {
- gtk_widget_activate (window->focus_widget);
- gdk_property_get (window->focus_widget->window,
- gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE),
- gdk_atom_intern ("CARDINAL", FALSE),
- 0,
- sizeof (jobject),
- FALSE,
- NULL,
- NULL,
- NULL,
- (guchar **)&obj_ptr);
-
- /* if (grab && GTK_WIDGET_HAS_DEFAULT (widget) ) */
- /* { */
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
- postKeyEventID,
- (jint) AWT_KEY_PRESSED,
- (jlong) event->key.time,
- state_to_awt_mods (event->key.state),
- keysym_to_awt_keycode (event->key.keyval),
- (jchar) (event->key.length) ?
- event->key.string[0] :
- AWT_KEY_CHAR_UNDEFINED);
- if (event->key.length)
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
- postKeyEventID,
- (jint) AWT_KEY_TYPED,
- (jlong) event->key.time,
- state_to_awt_mods (event->key.state),
- VK_UNDEFINED,
- (jchar) event->key.string[0]);
- }
- }
- break;
- case GDK_FOCUS_CHANGE:
- (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
- postFocusEventID,
- (jint) (event->focus_change.in) ?
- AWT_FOCUS_GAINED : AWT_FOCUS_LOST,
- JNI_FALSE);
- break;
- default:
- }
- g_free (obj_ptr);
- }
-
- gtk_main_do_event (event);
-}
-
-static void
-attach_jobject (GdkWindow *window, jobject *obj)
-{
- GdkAtom addr_atom = gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE);
- GdkAtom type_atom = gdk_atom_intern ("CARDINAL", FALSE);
-
- gdk_window_set_events (window,
- gdk_window_get_events (window)
- | GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_KEY_PRESS_MASK
- | GDK_KEY_RELEASE_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_STRUCTURE_MASK
- | GDK_KEY_PRESS_MASK
- | GDK_FOCUS_CHANGE_MASK);
-
- gdk_property_change (window,
- addr_atom,
- type_atom,
- 8,
- GDK_PROP_MODE_REPLACE,
- (guchar *)obj,
- sizeof (jobject));
-}
-
-void
-connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...)
-{
- int i;
- va_list ap;
- jobject *obj;
-
- obj = (jobject *) malloc (sizeof (jobject));
- *obj = (*env)->NewGlobalRef (env, peer_obj);
-
- va_start (ap, nwindows);
- for (i = 0; i < nwindows; i++)
- attach_jobject (va_arg (ap, GdkWindow *), obj);
- va_end (ap);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
deleted file mode 100644
index 2308d1100ed..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* gtkfiledialogpeer.c -- Native implementation of GtkFileDialogPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h"
-
-/*
- * Make a new file selection dialog
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
- (JNIEnv *env, jobject obj)
-{
- gpointer widget;
-
- gdk_threads_enter ();
- widget = gtk_type_new (gtk_file_selection_get_type ());
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- /* NOTE: we don't call the superclass connect method here. */
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
-
- gdk_threads_leave ();
-}
-
-/*
- * Set the filename in the file selection dialog.
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_gtkFileSelectionSetFilename
- (JNIEnv *env, jobject obj, jstring filename)
-{
- void *ptr;
- const char *str;
-
- ptr = NSA_GET_PTR (env, obj);
-
- str = (*env)->GetStringUTFChars (env, filename, 0);
- gdk_threads_enter ();
- gtk_file_selection_set_filename (GTK_FILE_SELECTION (ptr), str);
- gdk_threads_leave ();
- (*env)->ReleaseStringUTFChars (env, filename, str);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
deleted file mode 100644
index dd446c89489..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* gtkimagepainter.c
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkImagePainter.h"
-#include <libart_lgpl/art_misc.h>
-#include <libart_lgpl/art_rgb_affine.h>
-
-#define SWAPU32(w) \
- (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
-(JNIEnv *env, jobject obj, jobject gc_obj, jint bg_red, jint bg_green,
- jint bg_blue, jint x, jint y, jint width, jint height, jintArray jpixels,
- jint offset, jint scansize, jdoubleArray jaffine)
-{
- struct graphics *g;
- jint *pixels, *elems;
- guchar *packed;
- int i;
- jsize num_pixels;
- guchar *j_rgba, *c_rgb;
-
- g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
-
- elems = (*env)->GetIntArrayElements (env, jpixels, NULL);
- num_pixels = (*env)->GetArrayLength (env, jpixels);
-
- /* get a copy of the pixel data so we can modify it */
- pixels = malloc (sizeof (jint) * num_pixels);
- memcpy (pixels, elems, sizeof (jint) * num_pixels);
-
- (*env)->ReleaseIntArrayElements (env, jpixels, elems, 0);
-
-#ifndef WORDS_BIGENDIAN
- /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
- for (i = 0; i < num_pixels; i++)
- pixels[i] = SWAPU32 ((unsigned)pixels[i]);
-#endif
-
- packed = (guchar *) malloc (sizeof (guchar) * 3 * num_pixels);
- j_rgba = (guchar *) pixels;
- c_rgb = packed;
-
- /* copy over pixels in DirectColorModel format to 24 bit RGB image data,
- and process the alpha channel */
- for (i = 0; i < num_pixels; i++)
- {
- jint ialpha = *j_rgba++;
-
- switch (ialpha)
- {
- case 0: /* full transparency */
- *c_rgb++ = bg_red;
- *c_rgb++ = bg_green;
- *c_rgb++ = bg_blue;
- j_rgba += 3;
- break;
- case 255: /* opaque */
- *c_rgb++ = *j_rgba++;
- *c_rgb++ = *j_rgba++;
- *c_rgb++ = *j_rgba++;
- break;
- default: /* compositing required */
- {
- jfloat alpha = ialpha / 255.0;
- jfloat comp_alpha = 1.0 - alpha;
-
- *c_rgb++ = *j_rgba++ * alpha + bg_red * comp_alpha;
- *c_rgb++ = *j_rgba++ * alpha + bg_green * comp_alpha;
- *c_rgb++ = *j_rgba++ * alpha + bg_blue * comp_alpha;
- }
- break;
- }
- }
-
- if (jaffine)
- {
- jdouble *affine;
- ArtAlphaGamma *alphagamma = NULL;
- art_u8 *dst;
- int new_width, new_height;
- int i;
-
- affine = (*env)->GetDoubleArrayElements (env, jaffine, NULL);
-
- new_width = abs (width * affine[0]);
- new_height = abs (height * affine[3]);
-
- dst = (art_u8 *) malloc (sizeof (art_u8) * 3 * (new_width * new_height));
-
- art_rgb_affine (dst,
- 0, 0,
- new_width, new_height,
- new_width * 3,
- (art_u8 *) packed + offset * 3,
- width, height,
- scansize * 3,
- affine,
- ART_FILTER_NEAREST,
- alphagamma);
-
- (*env)->ReleaseDoubleArrayElements (env, jaffine, affine, JNI_ABORT);
-
- free (packed);
- packed = (guchar *) dst;
-
- width = scansize = new_width;
- height = new_height;
- offset = 0;
- }
-
- gdk_threads_enter ();
-
- gdk_draw_rgb_image (g->drawable,
- g->gc,
- x + g->x_offset,
- y + g->y_offset,
- width, height, GDK_RGB_DITHER_NORMAL,
- packed + offset * 3, scansize * 3);
-
- gdk_threads_leave ();
-
- free (pixels);
- free (packed);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
deleted file mode 100644
index 9313a8a815b..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* gtklabelpeer.c -- Native implementation of GtkLabelPeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkLabelPeer.h"
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
- (JNIEnv *env, jobject obj)
-{
- GtkWidget *label;
- GtkContainer *ebox;
-
- gdk_threads_enter ();
- ebox = GTK_CONTAINER (gtk_type_new (gtk_event_box_get_type ()));
- label = GTK_WIDGET (gtk_type_new (gtk_label_get_type ()));
- gtk_container_add (ebox, label);
- gtk_widget_show (label);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, ebox);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
deleted file mode 100644
index 5787ce5083e..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/* gtklistpeer.c -- Native implementation of GtkListPeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkListPeer.h"
-
-static void
-connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list);
-
-#define CLIST_FROM_SW(obj) (GTK_CLIST(GTK_SCROLLED_WINDOW (obj)->container.child))
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_create
- (JNIEnv *env, jobject obj)
-{
- GtkWidget *list, *sw;
-
- gdk_threads_enter ();
- list = gtk_clist_new (1);
- gtk_widget_show (list);
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (sw), list);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, sw);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_selectable_hook (env, obj, CLIST_FROM_SW (ptr));
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_append
- (JNIEnv *env, jobject obj, jobjectArray items)
-{
- void *ptr;
- GtkCList *list;
- jint count, i;
-
- ptr = NSA_GET_PTR (env, obj);
-
- count = (*env)->GetArrayLength (env, items);
-
- gdk_threads_enter ();
- list = CLIST_FROM_SW (ptr);
- for (i = 0; i < count; i++)
- {
- const char *text;
- jobject item;
-
- item = (*env)->GetObjectArrayElement (env, items, i);
-
- text = (*env)->GetStringUTFChars (env, item, NULL);
- gtk_clist_append (list, (char **)&text);
- (*env)->ReleaseStringUTFChars (env, item, text);
- }
-
- gtk_clist_columns_autosize (list);
- gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_old_create
- (JNIEnv *env, jobject obj, jobject parent_obj,
- jobjectArray items, jboolean mode)
-{
- GtkWidget *list, *sw, *parent;
- jsize count, i;
-
- parent = NSA_GET_PTR (env, parent_obj);
-
- count = (*env)->GetArrayLength (env, items);
-
- gdk_threads_enter ();
-
- list = gtk_clist_new (1);
- gtk_widget_show (list);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- set_parent (sw, GTK_CONTAINER (parent));
- gtk_widget_realize (sw);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (sw), list);
-
- connect_selectable_hook (env, obj, GTK_CLIST (list));
- connect_awt_hook (env, obj, 1, list->window);
-
- gtk_clist_set_selection_mode (GTK_CLIST (list),
- mode ? GTK_SELECTION_MULTIPLE :
- GTK_SELECTION_SINGLE);
-
- for (i = 0; i < count; i++)
- {
- const char *text;
- jobject item;
-
- item = (*env)->GetObjectArrayElement (env, items, i);
-
- text = (*env)->GetStringUTFChars (env, item, NULL);
- gtk_clist_append (GTK_CLIST (list), (char **)&text);
- (*env)->ReleaseStringUTFChars (env, item, text);
- }
-
- gtk_clist_columns_autosize (GTK_CLIST (list));
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, sw);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_add
- (JNIEnv *env, jobject obj, jstring text, jint index)
-{
- void *ptr;
- const char *str;
-
- ptr = NSA_GET_PTR (env, obj);
- str = (*env)->GetStringUTFChars (env, text, NULL);
-
- gdk_threads_enter ();
- gtk_clist_insert (CLIST_FROM_SW (ptr), index, (char **)&str);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, text, str);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems
- (JNIEnv *env, jobject obj, jint start, jint end)
-{
- void *ptr;
- GtkCList *list;
- jint i;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- list = CLIST_FROM_SW (ptr);
-
- if (end == -1) /* special case for removing all rows */
- end = list->rows;
-
- gtk_clist_freeze (list);
- for (i = start; i < end; i++)
- gtk_clist_remove (list, i);
- gtk_clist_thaw (list);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_select
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_clist_select_row (CLIST_FROM_SW (ptr), index, 0);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_clist_unselect_row (CLIST_FROM_SW (ptr), index, 0);
- gdk_threads_leave ();
-}
-
-/* FIXME: magic mojo (that doesn't seem to do anything) */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize
- (JNIEnv *env, jobject obj, jint rows, jintArray jdims)
-{
- void *ptr;
- jint *dims;
- GtkWidget *list;
- GtkScrolledWindow *sw;
- GtkRequisition myreq;
-
- dims = (*env)->GetIntArrayElements (env, jdims, NULL);
- dims[0] = dims[1] = 0;
-
- if (rows < 3)
- rows = 3;
-
- ptr = NSA_GET_PTR (env, obj);
- gdk_threads_enter ();
-
- list = GTK_WIDGET (CLIST_FROM_SW (ptr));
- sw = GTK_SCROLLED_WINDOW (ptr);
-
- /*
- gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
- &myreq);
- dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
- */
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- "size_request", &myreq);
- /*
-
- gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- &myreq);
- */
-
- dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
-
- gtk_signal_emit_by_name (GTK_OBJECT (list), "size_request", &myreq);
-
- // gtk_widget_size_request(GTK_WIDGET (list), &myreq);
-
- dims[0] += myreq.width + gdk_char_width (list->style->font, 'W');
-
- dims[1] += ((rows * (gdk_char_height (list->style->font, 'W')+7))
- + (2 * (list->style->klass->ythickness)));
-
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
-}
-
-
-JNIEXPORT jintArray JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- GtkCList *list;
- jintArray selection;
- jint *sel;
- GList *child;
- jint count, i;
-
- ptr = NSA_GET_PTR (env, obj);
- gdk_threads_enter ();
-
- list = CLIST_FROM_SW (ptr);
- count = g_list_length (list->selection);
-
- selection = (*env)->NewIntArray (env, count);
- sel = (*env)->GetIntArrayElements (env, selection, NULL);
-
- for (i = 0, child = list->selection; i < count; i++)
- {
- sel[i] = GPOINTER_TO_INT (child->data);
- child = g_list_next (child);
- }
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements (env, selection, sel, 0);
-
- return selection;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_clist_moveto (CLIST_FROM_SW (ptr), index, 0, 0.5, 0.5);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_setMultipleMode
- (JNIEnv *env, jobject obj, jboolean mode)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_clist_set_selection_mode (CLIST_FROM_SW (ptr),
- mode ? GTK_SELECTION_MULTIPLE :
- GTK_SELECTION_SINGLE);
- gdk_threads_leave ();
-}
-
-static void
-item_select (GtkCList *list, int row, int col, GdkEventButton *event,
- jobject *peer_obj)
-{
- (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
- postListItemEventID,
- row,
- (jint) AWT_ITEM_SELECTED);
-}
-
-static void
-item_unselect (GtkCList *list, int row, int col, GdkEventButton *event,
- jobject *peer_obj)
-{
- (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
- postListItemEventID,
- row,
- (jint) AWT_ITEM_DESELECTED);
-}
-
-static void
-connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list)
-{
- jobject *obj;
-
- obj = (jobject *) malloc (sizeof (jobject));
- *obj = (*env)->NewGlobalRef (env, peer_obj);
-
- gtk_signal_connect (GTK_OBJECT (list), "select_row",
- GTK_SIGNAL_FUNC (item_select), obj);
-
- gtk_signal_connect (GTK_OBJECT (list), "unselect_row",
- GTK_SIGNAL_FUNC (item_unselect), obj);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
deleted file mode 100644
index af14f0be8a9..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* gtkmainthread.c -- Native implementation of GtkMainThread
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkMainThread.h"
-#include "gthread-jni.h"
-
-#ifdef JVM_SUN
- struct state_table *native_state_table;
-#endif
-
-jmethodID postActionEventID;
-jmethodID postMenuActionEventID;
-jmethodID postMouseEventID;
-jmethodID postConfigureEventID;
-jmethodID postExposeEventID;
-jmethodID postKeyEventID;
-jmethodID postFocusEventID;
-jmethodID postAdjustmentEventID;
-jmethodID postItemEventID;
-jmethodID postListItemEventID;
-JNIEnv *gdk_env;
-
-/*
- * Call gtk_init. It is very important that this happen before any other
- * gtk calls.
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz)
-{
- int argc = 1;
- char **argv;
- char *homedir, *rcpath = NULL;
-/* jclass gtkgenericpeer; */
- jclass gtkcomponentpeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer, gtkmenuitempeer;
-
- NSA_INIT (env, clazz);
-
- /* GTK requires a program's argc and argv variables, and requires that they
- be valid. */
-
- argv = (char **) malloc (sizeof (char *) * 2);
- argv[0] = "";
- argv[1] = NULL;
-
- /* until we have JDK 1.2 JNI, assume we have a VM with threads that
- match what GLIB was compiled for */
- g_thread_init (NULL);
-
- gtk_init (&argc, &argv);
-
- gdk_rgb_init ();
- gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
- gtk_widget_set_default_visual (gdk_rgb_get_visual ());
-
- /* Make sure queued calls don't get sent to GTK/GDK while
- we're shutting down. */
- atexit (gdk_threads_enter);
-
- gdk_env = env;
- gdk_event_handler_set ((GdkEventFunc)awt_event_handler, NULL, NULL);
-
- if ((homedir = getenv ("HOME")))
- {
- rcpath = (char *) malloc (strlen (homedir) + strlen (RC_FILE) + 2);
- sprintf (rcpath, "%s/%s", homedir, RC_FILE);
- }
-
- gtk_rc_parse ((rcpath) ? rcpath : RC_FILE);
-
- if (rcpath)
- free (rcpath);
-
- free (argv);
-
- /* setup cached IDs for posting GTK events to Java */
-/* gtkgenericpeer = (*env)->FindClass (env, */
-/* "gnu/java/awt/peer/gtk/GtkGenericPeer"); */
- gtkcomponentpeer = (*env)->FindClass (env,
- "gnu/java/awt/peer/gtk/GtkComponentPeer");
- gtkwindowpeer = (*env)->FindClass (env,
- "gnu/java/awt/peer/gtk/GtkWindowPeer");
- gtkscrollbarpeer = (*env)->FindClass (env,
- "gnu/java/awt/peer/gtk/GtkScrollbarPeer");
- gtklistpeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkListPeer");
- gtkmenuitempeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkMenuItemPeer");
-/* gdkColor = (*env)->FindClass (env, */
-/* "gnu/java/awt/peer/gtk/GdkColor"); */
-/* gdkColorID = (*env)->GetMethodID (env, gdkColor, "<init>", "(III)V"); */
-/* postActionEventID = (*env)->GetMethodID (env, gtkgenericpeer, */
-/* "postActionEvent", */
-/* "(Ljava/lang/String;I)V"); */
-
- postMenuActionEventID = (*env)->GetMethodID (env, gtkmenuitempeer,
- "postMenuActionEvent",
- "()V");
- postMouseEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
- "postMouseEvent", "(IJIIIIZ)V");
- postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer,
- "postConfigureEvent", "(IIIIIIII)V");
- postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
- "postExposeEvent", "(IIII)V");
- postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
- "postKeyEvent", "(IJIIC)V");
- postFocusEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
- "postFocusEvent", "(IZ)V");
- postAdjustmentEventID = (*env)->GetMethodID (env, gtkscrollbarpeer,
- "postAdjustmentEvent",
- "(II)V");
- postItemEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
- "postItemEvent",
- "(Ljava/lang/Object;I)V");
- postListItemEventID = (*env)->GetMethodID (env, gtklistpeer,
- "postItemEvent",
- "(II)V");
-}
-
-/*
- * Run gtk_main and block.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkMain (JNIEnv *env, jobject obj)
-{
- gdk_threads_enter ();
- gtk_main ();
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
deleted file mode 100644
index 89818e05fb1..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* gtkmenubarpeer.c -- Native implementation of GtkMenuBarPeer
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkMenuBarPeer.h"
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
- (JNIEnv *env, jobject obj)
-{
- GtkWidget *widget;
-
- gdk_threads_enter ();
- widget = gtk_menu_bar_new ();
- gtk_widget_show (widget);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
- (JNIEnv *env, jobject obj, jobject menupeer)
-{
- void *mbar, *menu;
-
- mbar = NSA_GET_PTR (env, obj);
- menu = NSA_GET_PTR (env, menupeer);
-
- gdk_threads_enter ();
- gtk_menu_bar_append (GTK_MENU_BAR (mbar), GTK_WIDGET (menu));
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
- GList *list;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- list = gtk_container_children (GTK_CONTAINER (ptr));
- list = g_list_nth (list, index);
- gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
deleted file mode 100644
index ee3920867a8..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
-
-static void
-connect_activate_hook (JNIEnv *, jobject, GtkMenuItem *);
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
- (JNIEnv *env, jobject obj, jstring label)
-{
- GtkWidget *widget;
- const char *str;
-
- str = (*env)->GetStringUTFChars (env, label, NULL);
-
- gdk_threads_enter ();
-
- if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
- widget = gtk_menu_item_new ();
- else
- widget = gtk_menu_item_new_with_label (str);
-
- connect_activate_hook (env, obj, GTK_MENU_ITEM (widget));
- gtk_widget_show (widget);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, label, str);
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
- (JNIEnv *env, jobject obj, jstring label)
-{
- void *ptr;
- const char *str;
-
- ptr = NSA_GET_PTR (env, obj);
-
- str = (*env)->GetStringUTFChars (env, label, NULL);
-
- gdk_threads_enter ();
-
- if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
- gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child);
- else
- {
- GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
-
- gtk_label_set_text (GTK_LABEL (accel_label), str);
- gtk_accel_label_refetch (accel_label);
- }
-
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, label, str);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
- (JNIEnv *env, jobject obj, jboolean enabled)
-{
-/* Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setEnabled (env, obj, enabled); */
-}
-
-static void
-item_activate (GtkMenuItem *item, jobject *peer_obj)
-{
- (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
- postMenuActionEventID);
-}
-
-static void
-connect_activate_hook (JNIEnv *env, jobject peer_obj, GtkMenuItem *item)
-{
- jobject *obj;
-
- obj = (jobject *) malloc (sizeof (jobject));
- *obj = (*env)->NewGlobalRef (env, peer_obj);
-
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (item_activate), obj);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
deleted file mode 100644
index ec8154276cd..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* gtkmenupeer.c -- Native implementation of GtkMenuPeer
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkMenuPeer.h"
-
-static void
-accel_attach (GtkMenuItem *menu_item, gpointer *user_data)
-{
- GtkAccelGroup *accel;
-
- accel = gtk_menu_get_accel_group (GTK_MENU (menu_item->submenu));
- gtk_accel_group_attach (accel,
- GTK_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET(menu_item))));
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
- (JNIEnv *env, jobject obj, jobject parent)
-{
- void *ptr1, *ptr2;
-
- ptr1 = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- if (!parent)
- {
- gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
- gtk_accel_group_new ());
-
- if (GTK_WIDGET_REALIZED (GTK_WIDGET (ptr1)))
- accel_attach (GTK_MENU_ITEM (ptr1), NULL);
- else
- gtk_signal_connect (GTK_OBJECT (ptr1),
- "realize",
- GTK_SIGNAL_FUNC (accel_attach),
- NULL);
- }
- else
- {
- GtkAccelGroup *parent_accel;
-
- ptr2 = NSA_GET_PTR (env, parent);
- parent_accel = gtk_menu_get_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr2)->submenu));
-
- gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
- parent_accel);
- }
-
- gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
- (JNIEnv *env, jobject obj, jstring label)
-{
- GtkWidget *menu_title, *menu;
- const char *str;
-
- str = (*env)->GetStringUTFChars (env, label, NULL);
-
- gdk_threads_enter ();
- menu = gtk_menu_new ();
-
- menu_title = gtk_menu_item_new_with_label (str);
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu);
-
- gtk_widget_show (menu);
- gtk_widget_show (menu_title);
-
- NSA_SET_PTR (env, obj, menu_title);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, label, str);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
- (JNIEnv *env, jobject obj, jobject menuitempeer, jint key, jboolean shift)
-{
- void *ptr1, *ptr2;
- GtkMenu *menu;
-
- ptr1 = NSA_GET_PTR (env, obj);
- ptr2 = NSA_GET_PTR (env, menuitempeer);
-
- gdk_threads_enter ();
-
- menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
- gtk_menu_append (menu, GTK_WIDGET (ptr2));
-
- if (key)
- {
- gtk_widget_add_accelerator (GTK_WIDGET (ptr2), "activate",
- gtk_menu_get_accel_group (menu), key,
- (GDK_CONTROL_MASK
- | ((shift) ? GDK_SHIFT_MASK : 0)),
- GTK_ACCEL_VISIBLE);
- }
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
- (JNIEnv *env, jobject obj, jint index)
-{
- void *ptr;
- GList *list;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- list = gtk_container_children (GTK_CONTAINER (ptr));
- list = g_list_nth (list, index);
- gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
- gdk_threads_leave ();
-}
-
-
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
deleted file mode 100644
index b52c75d5311..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* gtkpanelpeer.c -- Native implementation of GtkPanelPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkPanelPeer.h"
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
- (JNIEnv *env, jobject obj)
-{
- gpointer widget;
-
- gdk_threads_enter ();
- widget = gtk_layout_new (NULL, NULL);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-typedef struct _GtkLayoutChild GtkLayoutChild;
-
-struct _GtkLayoutChild {
- GtkWidget *widget;
- gint x;
- gint y;
-};
-
-static
-void sr (GtkWidget *widget, GtkRequisition *requisition, gpointer user_data)
-{
- GtkLayout *layout;
- GtkLayoutChild *child;
- GList *children;
-
- layout = GTK_LAYOUT (widget);
- requisition->width = GTK_WIDGET (widget)->allocation.width;
- requisition->height = GTK_WIDGET (widget)->allocation.height;
-
- children = layout->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- requisition->height = MAX (requisition->height,
- child->y +
- child->widget->allocation.height);
- requisition->width = MAX (requisition->width,
- child->x +
- child->widget->allocation.width);
- }
- }
-
- requisition->height += GTK_CONTAINER (layout)->border_width * 2;
- requisition->width += GTK_CONTAINER (layout)->border_width * 2;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_LAYOUT (ptr)->bin_window);
-
-/* gtk_signal_connect (GTK_OBJECT (ptr), "size_request", GTK_SIGNAL_FUNC (sr), */
-/* NULL); */
- gdk_threads_leave ();
-}
-
-/*
- * Make a new panel.
- */
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkPanelPeer_gtkPanelNew
- (JNIEnv *env, jobject obj, jobject parent_obj)
-{
- GtkWidget *layout;
- void *parent;
-
- parent = NSA_GET_PTR (env, parent_obj);
-
- gdk_threads_enter ();
- layout = gtk_layout_new (NULL, NULL);
-
- set_parent (layout, GTK_CONTAINER (parent));
-
- gtk_widget_realize (layout);
- connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
- set_visible (layout, 1);
-
- NSA_SET_PTR (env, obj, layout);
- gdk_threads_leave ();
-}
-
-
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
deleted file mode 100644
index 66affcff255..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* gtkpopupmenupeer.c -- Native implementation of GtkPopupMenuPeer
- Copyright (C) 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h"
-
-struct pos
-{
- gint x;
- gint y;
-};
-
-void
-menu_pos (GtkMenu *menu, gint *x, gint *y, gpointer user_data)
-{
- struct pos *p = (struct pos *) user_data;
-
- *x = p->x;
- *y = p->y;
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
- (JNIEnv *env, jobject obj, jint x, jint y, jlong time)
-{
- void *ptr;
- struct pos *p;
-
- ptr = NSA_GET_PTR (env, obj);
-
- p = g_malloc (sizeof (struct pos));
- p->x = x;
- p->y = y;
-
- gdk_threads_enter ();
- gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu),
- NULL, NULL, menu_pos, p, 3, time);
- gdk_threads_leave ();
-
- g_free (p);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_setupAccelGroup
- (JNIEnv *env, jobject obj, jobject parent)
-{
- void *ptr1, *ptr2;
- GtkMenu *menu;
-
- ptr1 = NSA_GET_PTR (env, obj);
- ptr2 = NSA_GET_PTR (env, parent);
-
- gdk_threads_enter ();
- menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
- gtk_menu_set_accel_group (menu, gtk_accel_group_new ());
- gtk_accel_group_attach (gtk_menu_get_accel_group (menu),
- GTK_OBJECT (gtk_widget_get_toplevel (ptr2)));
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
deleted file mode 100644
index 4b8787e7d93..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* gtkscrollbarpeer.c -- Native implementation of GtkScrollbarPeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h"
-
-struct range_scrollbar
-{
- GtkRange *range;
- jobject *scrollbar;
-};
-
-static void
-post_adjustment_event (GtkAdjustment *adj, struct range_scrollbar *rs)
-{
- jint type;
-
- switch (rs->range->scroll_type)
- {
- case GTK_SCROLL_STEP_FORWARD:
- type = AWT_ADJUSTMENT_UNIT_INCREMENT;
- break;
- case GTK_SCROLL_STEP_BACKWARD:
- type = AWT_ADJUSTMENT_UNIT_DECREMENT;
- break;
- case GTK_SCROLL_PAGE_FORWARD:
- type = AWT_ADJUSTMENT_BLOCK_INCREMENT;
- break;
- case GTK_SCROLL_PAGE_BACKWARD:
- type = AWT_ADJUSTMENT_BLOCK_DECREMENT;
- break;
- case GTK_SCROLL_JUMP:
- type = AWT_ADJUSTMENT_TRACK;
- break;
- default: /* GTK_SCROLL_NONE */
- return;
- }
-
- (*gdk_env)->CallVoidMethod (gdk_env, *(rs->scrollbar), postAdjustmentEventID,
- type, (jint) adj->value);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
-(JNIEnv *env, jobject obj, jint orientation, jint value,
- jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
-{
- GtkWidget *sb;
- GtkObject *adj;
-
- gdk_threads_enter ();
- adj = gtk_adjustment_new (value, min, max,
- step_incr, page_incr,
- visible_amount);
-
- sb = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) :
- gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, sb);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- struct range_scrollbar *rs;
-
- rs = (struct range_scrollbar *) malloc (sizeof (struct range_scrollbar));
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
-
- rs->range = GTK_RANGE (ptr);
- rs->scrollbar = (jobject *) malloc (sizeof (jobject));
- *(rs->scrollbar) = (*env)->NewGlobalRef (env, obj);
- gtk_signal_connect (GTK_OBJECT (GTK_RANGE (ptr)->adjustment),
- "value_changed",
- GTK_SIGNAL_FUNC (post_adjustment_event), rs);
-
- connect_awt_hook (env, obj, 4,
- GTK_RANGE (ptr)->trough,
- GTK_RANGE (ptr)->slider,
- GTK_RANGE (ptr)->step_forw,
- GTK_RANGE (ptr)->step_back);
- gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
- (JNIEnv *env, jobject obj, jint amount)
-{
- void *ptr;
- GtkAdjustment *adj;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- adj = GTK_RANGE (ptr)->adjustment;
- adj->step_increment = amount;
- gtk_adjustment_changed (adj);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
- (JNIEnv *env, jobject obj, jint amount)
-{
- void *ptr;
- GtkAdjustment *adj;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- adj = GTK_RANGE (ptr)->adjustment;
- adj->page_increment = amount;
- gtk_adjustment_changed (adj);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues
- (JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
-{
- void *ptr;
- GtkAdjustment *adj;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- adj = GTK_RANGE (ptr)->adjustment;
- adj->value = value;
- adj->page_size = visible;
- adj->lower = min;
- adj->upper = max;
- gtk_adjustment_changed (adj);
-
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
deleted file mode 100644
index 499b3124d88..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* gtkscrollpanepeer.c -- Native implementation of GtkScrollPanePeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkScrollPanePeer.h"
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create
- (JNIEnv *env, jobject obj)
-{
- gpointer window;
- GtkWidget *layout;
-
- gdk_threads_enter ();
- window = gtk_scrolled_window_new (NULL, NULL);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, window);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setScrollPosition
- (JNIEnv *env, jobject obj, jint x, jint y)
-{
- GtkAdjustment *hadj, *vadj;
- GtkScrolledWindow *sw;
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- sw = GTK_SCROLLED_WINDOW (ptr);
-
- hadj = gtk_scrolled_window_get_hadjustment (sw);
- vadj = gtk_scrolled_window_get_vadjustment (sw);
-
- gtk_adjustment_set_value (hadj, x);
- gtk_adjustment_set_value (vadj, y);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetHScrollIncrement
- (JNIEnv *env, jobject obj, jint u)
-{
- GtkAdjustment *hadj;
- GtkScrolledWindow *sw;
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- sw = GTK_SCROLLED_WINDOW(ptr);
-
- hadj = gtk_scrolled_window_get_hadjustment (sw);
- hadj->step_increment = u;
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetVScrollIncrement
- (JNIEnv *env, jobject obj, jint u)
-{
- GtkAdjustment *vadj;
- GtkScrolledWindow *sw;
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- sw = GTK_SCROLLED_WINDOW(ptr);
-
- vadj = gtk_scrolled_window_get_hadjustment (sw);
- vadj->step_increment = u;
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_childResized
- (JNIEnv *env, jobject obj, jint width, jint height)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- return;
-
- gdk_threads_enter ();
- gtk_widget_set_usize (GTK_BIN (ptr)->child, width, height);
- gdk_threads_leave ();
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getHScrollbarHeight
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- GtkScrolledWindow *sw;
- jint height;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- sw = GTK_SCROLLED_WINDOW (ptr);
- height = (sw->hscrollbar_visible) ? sw->hscrollbar->allocation.height : 0;
- gdk_threads_leave ();
-
- return height;
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getVScrollbarWidth
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- GtkScrolledWindow *sw;
- jint width;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- sw = GTK_SCROLLED_WINDOW (ptr);
- width = (sw->vscrollbar_visible) ? sw->vscrollbar->allocation.width : 0;
- gdk_threads_leave ();
-
- return width;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setPolicy
- (JNIEnv *env, jobject obj, jint policy)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- switch (policy)
- {
- case AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED:
- policy = GTK_POLICY_AUTOMATIC;
- break;
- case AWT_SCROLLPANE_SCROLLBARS_ALWAYS:
- policy = GTK_POLICY_ALWAYS;
- break;
- case AWT_SCROLLPANE_SCROLLBARS_NEVER:
- policy = GTK_POLICY_NEVER;
- break;
- }
-
- gdk_threads_enter ();
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ptr), policy, policy);
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
deleted file mode 100644
index 8f58623d573..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* gtktextareapeer.c -- Native implementation of GtkTextAreaPeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkTextAreaPeer.h"
-
-#define TEXT_FROM_SW(obj) (GTK_TEXT(GTK_SCROLLED_WINDOW (obj)->container.child))
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
- (JNIEnv *env, jobject obj, jint scroll)
-{
- GtkWidget *text, *sw;
-
- gdk_threads_enter ();
- text = gtk_text_new (NULL, NULL);
- gtk_widget_show (text);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (sw), text);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
-
- /* horizontal scrollbar */
- (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
- || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ?
- GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
-
- /* vertical scrollbar */
- (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
- || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ?
- GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, sw);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_old_create
- (JNIEnv *env, jobject obj, jobject parent_obj,
- jstring contents, jint scroll)
-{
- GtkWidget *text, *sw;
- const char *str;
- int pos=0;
- void *parent;
-
- parent = NSA_GET_PTR (env, parent_obj);
- str = (*env)->GetStringUTFChars (env, contents, NULL);
-
- gdk_threads_enter ();
-
- text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (text), TRUE);
-
- gtk_editable_insert_text (GTK_EDITABLE (text), str,
- strlen (str), &pos);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (sw), text);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
-
- /* horizontal scrollbar */
- (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
- || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ?
- GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
-
- /* vertical scrollbar */
- (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
- || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ?
- GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
-
- set_visible (text, TRUE);
- set_parent (sw, GTK_CONTAINER (parent));
-
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, contents, str);
-
- NSA_SET_PTR (env, obj, sw);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkTextGetSize
- (JNIEnv *env, jobject obj, jint rows, jint cols, jintArray jdims)
-{
- void *ptr;
- jint *dims;
- GtkWidget *text;
- GtkScrolledWindow *sw;
- GtkRequisition myreq;
-
- ptr = NSA_GET_PTR (env, obj);
-
- dims = (*env)->GetIntArrayElements (env, jdims, 0);
- dims[0] = dims[1] = 0;
-
- gdk_threads_enter ();
-
- text = GTK_WIDGET (TEXT_FROM_SW (ptr));
- sw = GTK_SCROLLED_WINDOW (ptr);
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
- "size_request", &myreq);
- //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
- // &myreq);
- dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- "size_request", &myreq);
- //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
- // &myreq);
- dims[1]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
- (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
-
- /* The '1' in the following assignments is from
- #define TEXT_BORDER_ROOM 1
- in gtktext.c */
-
- dims[0] += ((cols * gdk_char_width (text->style->font, 'W'))
- + (2 * (text->style->klass->xthickness + 1)));
- dims[1] += ((rows * gdk_char_height (text->style->font, 'W'))
- + (2 * (text->style->klass->ythickness + 1)));
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
- (JNIEnv *env, jobject obj, jstring contents, jint position)
-{
- void *ptr;
- const char *str;
- int pos=position;
-
- ptr = NSA_GET_PTR (env, obj);
- str = (*env)->GetStringUTFChars (env, contents, NULL);
-
- gdk_threads_enter ();
- gtk_editable_insert_text (GTK_EDITABLE (TEXT_FROM_SW (ptr)),
- str, strlen (str), &pos);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, contents, str);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
- (JNIEnv *env, jobject obj, jstring contents, jint start, jint end)
-{
- void *ptr;
- GtkEditable *text;
- const char *str;
- int pos = start;
-
- ptr = NSA_GET_PTR (env, obj);
- str = (*env)->GetStringUTFChars (env, contents, NULL);
-
- gdk_threads_enter ();
-
- text = GTK_EDITABLE (TEXT_FROM_SW (ptr));
- gtk_text_freeze (GTK_TEXT (text));
- gtk_editable_delete_text (text, start, end);
- gtk_editable_insert_text (text, str, strlen (str), &pos);
- gtk_text_thaw (GTK_TEXT (text));
-
- gdk_threads_leave ();
- (*env)->ReleaseStringUTFChars (env, contents, str);
-}
-
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
deleted file mode 100644
index 0b6db8f1840..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* gtktextcomponentpeer.c -- Native implementation of GtkTextComponentPeer
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkTextComponentPeer.h"
-
-#define GET_EDITABLE(obj) (GTK_IS_EDITABLE (obj) ? GTK_EDITABLE (obj) : \
- GTK_EDITABLE (GTK_SCROLLED_WINDOW (obj)->container.child))
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getCaretPosition
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- int pos;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- pos = gtk_editable_get_position (GET_EDITABLE (ptr));
- gdk_threads_leave ();
-
- return pos;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setCaretPosition
- (JNIEnv *env, jobject obj, jint pos)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_editable_set_position (GET_EDITABLE (ptr), pos);
- gdk_threads_leave ();
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- int pos;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- pos = GET_EDITABLE (ptr)->selection_start_pos;
- gdk_threads_leave ();
-
- return pos;
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- int pos;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- pos = GET_EDITABLE (ptr)->selection_end_pos;
- gdk_threads_leave ();
-
- return pos;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_select
- (JNIEnv *env, jobject obj, jint start, jint end)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_editable_select_region (GET_EDITABLE (ptr), start, end);
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setEditable
- (JNIEnv *env, jobject obj, jboolean state)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_editable_set_editable (GET_EDITABLE (ptr), state);
- gdk_threads_leave ();
-}
-
-JNIEXPORT jstring JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getText
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- char *contents;
- jstring jcontents;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- contents = gtk_editable_get_chars (GET_EDITABLE (ptr), 0, -1);
- gdk_threads_leave ();
-
- jcontents = (*env)->NewStringUTF (env, contents);
- g_free (contents);
-
- return jcontents;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setText
- (JNIEnv *env, jobject obj, jstring contents)
-{
- void *ptr;
- GtkEditable *text;
- const char *str;
- int pos = 0;
-
- ptr = NSA_GET_PTR (env, obj);
- str = (*env)->GetStringUTFChars (env, contents, NULL);
-
- gdk_threads_enter ();
-
- text = GET_EDITABLE (ptr);
-
- if (GTK_IS_TEXT (text))
- gtk_text_freeze (GTK_TEXT (text));
-
- gtk_editable_delete_text (text, 0, -1);
- gtk_editable_insert_text (text, str, strlen (str), &pos);
-
- if (GTK_IS_TEXT (text))
- gtk_text_thaw (GTK_TEXT (text));
-
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, contents, str);
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
deleted file mode 100644
index 9085a57937d..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* gtktextfieldpeer.c -- Native implementation of GtkTextFieldPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkTextFieldPeer.h"
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create
- (JNIEnv *env, jobject obj)
-{
- gpointer widget;
-
- gdk_threads_enter ();
- widget = gtk_type_new (gtk_entry_get_type ());
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, widget);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 2,
- GTK_WIDGET (ptr)->window,
- GTK_ENTRY (ptr)->text_area);
- gdk_threads_leave ();
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_old_create
- (JNIEnv *env, jobject obj, jobject parent_obj, jstring text)
-{
- GtkWidget *entry;
- const char *str;
- void *parent;
-
- parent = NSA_GET_PTR (env, parent_obj);
-
- str = (*env)->GetStringUTFChars (env, text, NULL);
- gdk_threads_enter ();
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), str);
-
- set_parent (entry, GTK_CONTAINER (parent));
-
- gtk_widget_realize (entry);
- connect_awt_hook (env, obj, 2,
- entry->window, GTK_ENTRY (entry)->text_area);
-
- NSA_SET_PTR (env, obj, entry);
-
- gdk_threads_leave ();
- (*env)->ReleaseStringUTFChars (env, text, str);
-}
-
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetSize
- (JNIEnv *env, jobject obj, jint cols, jintArray jdims)
-{
- void *ptr;
- jint *dims;
- GtkRequisition myreq;
- GtkEntry *entry;
-
- ptr = NSA_GET_PTR (env, obj);
- dims = (*env)->GetIntArrayElements (env, jdims, 0);
-
- gdk_threads_enter ();
- entry = GTK_ENTRY (ptr);
-
- gtk_signal_emit_by_name (GTK_OBJECT (entry), "size_request", &myreq);
-
- dims[0]=myreq.width-150 + (cols *
- gdk_char_width (GTK_WIDGET (entry)->style->font,
- 'W'));
- dims[1]=myreq.height;
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
- (JNIEnv *env, jobject obj, jchar c)
-{
- void *ptr;
- GtkEntry *entry;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- entry = GTK_ENTRY (ptr);
-
- if (c!=0)
- {
-/* gtk_entry_set_echo_char (entry, c); */
- gtk_entry_set_visibility (entry, FALSE);
- }
- else
- gtk_entry_set_visibility (entry, TRUE);
-
- gdk_threads_leave ();
-}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
deleted file mode 100644
index 1436badea5a..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* gtktoolkit.c -- Native portion of GtkToolkit
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkToolkit.h"
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_beep (JNIEnv *env, jobject obj)
-{
- gdk_threads_enter ();
- gdk_beep ();
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_sync (JNIEnv *env, jobject obj)
-{
- gdk_threads_enter ();
- gdk_flush ();
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenSizeDimensions
-(JNIEnv *env, jobject obj, jintArray jdims)
-{
- jint *dims = (*env)->GetIntArrayElements (env, jdims, 0);
-
- gdk_threads_enter ();
-
- dims[0] = gdk_screen_width ();
- dims[1] = gdk_screen_height ();
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution (JNIEnv *env,
- jobject obj)
-{
- jint res;
-
- gdk_threads_enter ();
-
- res = gdk_screen_width () / (gdk_screen_width_mm () / 25.4);
-
- gdk_threads_leave ();
- return res;
-}
-
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
deleted file mode 100644
index 3b7c06bf057..00000000000
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h"
-#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkx.h>
-
-static void setBounds (GtkWidget *, jint, jint, jint, jint);
-
-/*
- * Make a new window (any type)
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
- (JNIEnv *env, jobject obj, jint type)
-{
- gpointer window;
- GtkWidget *vbox, *layout;
-
- gdk_threads_enter ();
- window = gtk_window_new (type);
-
- vbox = gtk_vbox_new (0, 0);
- layout = gtk_layout_new (NULL, NULL);
- gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- gtk_widget_show (layout);
- gtk_widget_show (vbox);
-
- gdk_threads_leave ();
-
- NSA_SET_PTR (env, obj, window);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisible
- (JNIEnv *env, jobject obj, jboolean visible)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- if (visible)
- gtk_widget_show (GTK_WIDGET (ptr));
- else
- gtk_widget_hide (GTK_WIDGET (ptr));
-
- XFlush (GDK_DISPLAY ());
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- GtkWidget *layout;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- layout = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child))->data);
- gtk_widget_realize (layout);
- connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
-
- gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
- gdk_threads_leave ();
-}
-
-void
-setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
- jint height, jboolean visible)
-{
- GtkWidget *layout, *vbox;
- gint x, y;
-
- gtk_window_set_policy (GTK_WINDOW (window), 1, 1, 0);
- gtk_widget_set_usize (window, width, height);
-
- vbox = gtk_vbox_new (0, 0);
- layout = gtk_layout_new (NULL, NULL);
- gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_widget_realize (layout);
- connect_awt_hook (env, obj, 1, GTK_LAYOUT(layout)->bin_window);
- gtk_widget_show (layout);
- gtk_widget_show (vbox);
-
- gtk_widget_realize (window);
-/* setBounds (window, x, y, width, height); */
-
- connect_awt_hook (env, obj, 1, window->window);
- set_visible (window, visible);
-}
-
-/*
- * Set a frame's title
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setTitle
- (JNIEnv *env, jobject obj, jstring title)
-{
- void *ptr;
- const char *str;
-
- ptr = NSA_GET_PTR (env, obj);
-
- str = (*env)->GetStringUTFChars (env, title, NULL);
-
- gdk_threads_enter ();
- gtk_window_set_title (GTK_WINDOW (ptr), str);
- gdk_threads_leave ();
-
- (*env)->ReleaseStringUTFChars (env, title, str);
-}
-
-/*
- * Set a window's resizing policy
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setResizable
- (JNIEnv *env, jobject obj, jboolean resize)
-{
- void *ptr;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gtk_window_set_policy (GTK_WINDOW (ptr), resize, resize, 0);
- gdk_threads_leave ();
-}
-
-
-/*
- * Lower the z-level of a window.
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
- jobject obj)
-{
- void *ptr;
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_window_lower (GTK_WIDGET (ptr)->window);
-
- XFlush (GDK_DISPLAY ());
- gdk_threads_leave ();
-}
-
-/*
- * Raise the z-level of a window.
- */
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
- jobject obj)
-{
- void *ptr;
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- gdk_window_raise (GTK_WIDGET (ptr)->window);
-
- XFlush (GDK_DISPLAY ());
- gdk_threads_leave ();
-}
-
-static void
-setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height)
-{
- gint current_x, current_y;
- gint origin_x, origin_y;
-
-/* gdk_window_get_root_origin (widget->window, &current_x, &current_y); */
-
-/* if (current_x != x || current_y != y) */
-/* { */
-/* gdk_window_set_hints (widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS); */
-/* gdk_window_move (widget->window, x, y); */
-/* } */
-
- gtk_widget_set_usize (widget, width, height);
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
- (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
-{
- void *ptr;
- GtkWidget *widget;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- widget = GTK_WIDGET (ptr);
- setBounds (widget, x, y, width, height);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
- (JNIEnv *env, jobject obj, jobject menubar)
-{
- void *wptr, *mptr;
- GtkBox *box;
-
- if (!menubar) return;
-
- wptr = NSA_GET_PTR (env, obj);
- mptr = NSA_GET_PTR (env, menubar);
-
- if (!mptr) return; /* this case should remove a menu */
-
- gdk_threads_enter ();
- box = GTK_BOX (GTK_BIN (wptr)->child);
- gtk_box_pack_start (box, GTK_WIDGET (mptr), 0, 0, 0);
- gdk_threads_leave ();
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
- (JNIEnv *env, jobject obj)
-{
- void *ptr;
- GList *children;
- jint height = 0;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
- children = gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child));
- if (g_list_length (children) == 2)
- {
- GtkWidget *menubar = GTK_WIDGET (children->data);
- height = menubar->allocation.height;
-
- }
- gdk_threads_leave ();
-
- return height;
-}
-
-
-void
-gdk_window_get_root_geometry (GdkWindow *window,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- gint *border,
- gint *depth)
-{
- GdkWindowPrivate *private;
- Window xwindow;
- Window xparent;
- Window root;
- Window *children;
- unsigned int nchildren;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (x)
- *x = 0;
- if (y)
- *y = 0;
- if (width)
- *width = 0;
- if (height)
- *height = 0;
- if (border)
- *border = 0;
- if (depth)
- *depth = 0;
-
- if (private->destroyed)
- return;
-
- while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
- private = (GdkWindowPrivate*) private->parent;
- if (private->destroyed)
- return;
-
- xparent = private->xwindow;
- do
- {
- xwindow = xparent;
- if (!XQueryTree (private->xdisplay, xwindow,
- &root, &xparent,
- &children, &nchildren))
- return;
-
- if (children)
- XFree (children);
- }
- while (xparent != root);
-
- if (xparent == root)
- {
- unsigned int ww, wh, wb, wd;
- int wx, wy;
-
- if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
- {
- if (x)
- *x = wx;
- if (y)
- *y = wy;
- if (width)
- *width = ww;
- if (height)
- *height = wh;
- if (border)
- *border = wb;
- if (depth)
- *depth = wd;
- }
- }
-}
-
diff --git a/libjava/jni/gtk-peer/gthread-jni.c b/libjava/jni/gtk-peer/gthread-jni.c
deleted file mode 100644
index 9409720f9ac..00000000000
--- a/libjava/jni/gtk-peer/gthread-jni.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* gthread-jni.c -- JNI threading routines for GLIB
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include "gthread-jni.h"
-
-/*
- * This code has been written specifically to be used with GTK+ 1.2.
- * `Real' GLIB threading is not supported. We fake things where necessary.
- * Once we know we're running on a 1.2 VM, we can write a real implementation.
- */
-
-static GMutex *
-g_mutex_new_jni_impl (void)
-{
- jclass obj_class;
- jobject *mutex;
-
- obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/Object");
- if (obj_class == NULL)
- return NULL;
-
- mutex = (jobject *) g_malloc (sizeof (jobject));
- *mutex = (*gdk_env)->AllocObject (gdk_env, obj_class);
- if (*mutex == NULL)
- {
- g_free (mutex);
- return NULL;
- }
- *mutex = (*gdk_env)->NewGlobalRef (gdk_env, *mutex);
-
- return (GMutex *) mutex;
-}
-
-static void
-g_mutex_lock_jni_impl (GMutex *mutex)
-{
- if (mutex && mutex == gdk_threads_mutex)
- (*gdk_env)->MonitorEnter (gdk_env, *((jobject *)mutex));
-}
-
-static gboolean
-g_mutex_trylock_jni_impl (GMutex *mutex)
-{
- return FALSE;
-}
-
-static void
-g_mutex_unlock_jni_impl (GMutex *mutex)
-{
- if (mutex && mutex == gdk_threads_mutex)
- (*gdk_env)->MonitorExit (gdk_env, *((jobject *)mutex));
-}
-
-static void
-g_mutex_free_jni_impl (GMutex *mutex)
-{
- if (mutex && mutex == gdk_threads_mutex)
- {
- (*gdk_env)->DeleteGlobalRef (gdk_env, *((jobject *)mutex));
- g_free (mutex);
- }
-}
-
-static GPrivate *
-g_private_new_jni_impl (GDestroyNotify notify)
-{
- return NULL;
-}
-
-static gpointer
-g_private_get_jni_impl (GPrivate *private)
-{
- return NULL;
-}
-
-static void
-g_private_set_jni_impl (GPrivate *private, gpointer data)
-{
-}
-
-static GCond *
-g_cond_new_jni_impl ()
-{
- return NULL;
-}
-
-static void
-g_cond_signal_jni_impl (GCond *cond)
-{
-}
-
-static void
-g_cond_broadcast_jni_impl (GCond *cond)
-{
-}
-
-static void
-g_cond_wait_jni_impl (GCond *cond, GMutex *mutex)
-{
-}
-
-static gboolean
-g_cond_timed_wait_jni_impl (GCond *cond, GMutex *mutex)
-{
- return FALSE;
-}
-
-static void
-g_cond_free_jni_impl (GCond *cond)
-{
-}
-
-GThreadFunctions g_thread_jni_functions =
-{
- g_mutex_new_jni_impl, /* mutex_new */
- g_mutex_lock_jni_impl, /* mutex_lock */
- g_mutex_trylock_jni_impl, /* mutex_try_lock */
- g_mutex_unlock_jni_impl, /* mutex_unlock */
- g_mutex_free_jni_impl, /* mutex_free */
- g_cond_new_jni_impl, /* cond_new */
- g_cond_signal_jni_impl, /* cond_signal */
- g_cond_broadcast_jni_impl, /* cond_broadcast */
- g_cond_wait_jni_impl, /* cond_wait */
- g_cond_timed_wait_jni_impl, /* cond_timed_wait */
- g_cond_free_jni_impl, /* cond_free */
- g_private_new_jni_impl, /* private_new */
- g_private_get_jni_impl, /* private_get */
- g_private_set_jni_impl /* private_set */
-};
-
-void
-gdk_threads_wake ()
-{
-}
diff --git a/libjava/jni/gtk-peer/gthread-jni.h b/libjava/jni/gtk-peer/gthread-jni.h
deleted file mode 100644
index 0bb5a56f1d8..00000000000
--- a/libjava/jni/gtk-peer/gthread-jni.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* gthread-jni.h
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#ifndef __GTHREADJNI_H__
-#define __GTHREADJNI_H__
-
-#include <jni.h>
-#include <glib.h>
-#include "gtkpeer.h"
-
-extern GThreadFunctions g_thread_jni_functions;
-
-#endif /* __GTHREADJNI_H__ */
diff --git a/libjava/jni/gtk-peer/gtkpeer.h b/libjava/jni/gtk-peer/gtkpeer.h
deleted file mode 100644
index fa1f19b5a1d..00000000000
--- a/libjava/jni/gtk-peer/gtkpeer.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* gtkpeer.h -- Some global variables and #defines
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-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
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <config.h>
-#include "native_state.h"
-
-#include <jni.h>
-
-#define RC_FILE ".classpath-gtkrc"
-#define JVM_SUN
-/*
- #define JVM_JAPHAR
-*/
-
-#ifndef __GTKPEER_H__
-#define __GTKPEER_H__
-
-#ifdef JVM_SUN
-
-extern struct state_table *native_state_table;
-
-#define NSA_INIT(env, clazz) \
- native_state_table = init_state_table (env, clazz)
-
-#define NSA_GET_PTR(env, obj) \
- get_state (env, obj, native_state_table)
-
-#define NSA_SET_PTR(env, obj, ptr) \
- set_state (env, obj, native_state_table, (void *)ptr)
-
-#define NSA_DEL_PTR(env, obj) \
- remove_state_slot (env, obj, native_state_table)
-
-#endif /* JVM_SUN */
-
-struct graphics
-{
- GdkDrawable *drawable;
- GdkGC *gc;
- GdkColormap *cm;
- jint x_offset, y_offset;
-};
-
-#define AWT_DEFAULT_CURSOR 0
-#define AWT_CROSSHAIR_CURSOR 1
-#define AWT_TEXT_CURSOR 2
-#define AWT_WAIT_CURSOR 3
-#define AWT_SW_RESIZE_CURSOR 4
-#define AWT_SE_RESIZE_CURSOR 5
-#define AWT_NW_RESIZE_CURSOR 6
-#define AWT_NE_RESIZE_CURSOR 7
-#define AWT_N_RESIZE_CURSOR 8
-#define AWT_S_RESIZE_CURSOR 9
-#define AWT_W_RESIZE_CURSOR 10
-#define AWT_E_RESIZE_CURSOR 11
-#define AWT_HAND_CURSOR 12
-#define AWT_MOVE_CURSOR 13
-
-#define SYNTHETIC_EVENT_MASK (1 << 10)
-
-#define AWT_SHIFT_MASK (1 << 0)
-#define AWT_CTRL_MASK (1 << 1)
-#define AWT_META_MASK (1 << 2)
-#define AWT_ALT_MASK (1 << 3)
-
-#define AWT_BUTTON1_MASK (1 << 4)
-#define AWT_BUTTON2_MASK AWT_ALT_MASK
-#define AWT_BUTTON3_MASK AWT_META_MASK
-
-#define MULTI_CLICK_TIME 250
-/* as opposed to a MULTI_PASS_TIME :) */
-
-#define AWT_MOUSE_CLICKED 500
-#define AWT_MOUSE_PRESSED 501
-#define AWT_MOUSE_RELEASED 502
-#define AWT_MOUSE_MOVED 503
-#define AWT_MOUSE_ENTERED 504
-#define AWT_MOUSE_EXITED 505
-#define AWT_MOUSE_DRAGGED 506
-
-#define AWT_ADJUSTMENT_UNIT_INCREMENT 1
-#define AWT_ADJUSTMENT_UNIT_DECREMENT 2
-#define AWT_ADJUSTMENT_BLOCK_DECREMENT 3
-#define AWT_ADJUSTMENT_BLOCK_INCREMENT 4
-#define AWT_ADJUSTMENT_TRACK 5
-
-#define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0
-#define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1
-#define AWT_SCROLLPANE_SCROLLBARS_NEVER 2
-
-#define AWT_LABEL_LEFT 0
-#define AWT_LABEL_CENTER 1
-#define AWT_LABEL_RIGHT 2
-
-#define AWT_TEXTAREA_SCROLLBARS_BOTH 0
-#define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1
-#define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2
-
-#define AWT_ITEM_SELECTED 1
-#define AWT_ITEM_DESELECTED 2
-
-#define AWT_KEY_TYPED 400
-#define AWT_KEY_PRESSED 401
-#define AWT_KEY_RELEASED 402
-
-#define VK_UNDEFINED 0
-#define AWT_KEY_CHAR_UNDEFINED 0
-
-#define VK_0 48
-#define VK_1 49
-#define VK_2 50
-#define VK_3 51
-#define VK_4 52
-#define VK_5 53
-#define VK_6 54
-#define VK_7 55
-#define VK_8 56
-#define VK_9 57
-#define VK_A 65
-#define VK_ACCEPT 30
-#define VK_ADD 107
-#define VK_ALT 18
-#define VK_B 66
-#define VK_BACK_QUOTE 192
-#define VK_BACK_SLASH 92
-#define VK_BACK_SPACE 8
-#define VK_C 67
-#define VK_CANCEL 3
-#define VK_CAPS_LOCK 20
-#define VK_CLEAR 12
-#define VK_CLOSE_BRACKET 93
-#define VK_COMMA 44
-#define VK_CONTROL 17
-#define VK_CONVERT 28
-#define VK_D 68
-#define VK_DECIMAL 110
-#define VK_DELETE 127
-#define VK_DIVIDE 111
-#define VK_DOWN 40
-#define VK_E 69
-#define VK_END 35
-#define VK_ENTER 10
-#define VK_ESCAPE 27
-#define VK_F 70
-#define VK_F1 112
-#define VK_F10 121
-#define VK_F11 122
-#define VK_F12 123
-#define VK_F2 113
-#define VK_F3 114
-#define VK_F4 115
-#define VK_F5 116
-#define VK_F6 117
-#define VK_F7 118
-#define VK_F8 119
-#define VK_F9 120
-#define VK_FINAL 24
-#define VK_G 71
-#define VK_H 72
-#define VK_HELP 156
-#define VK_HOME 36
-#define VK_I 73
-#define VK_INSERT 155
-#define VK_J 74
-#define VK_K 75
-#define VK_KANA 21
-#define VK_KANJI 25
-#define VK_L 76
-#define VK_LEFT 37
-#define VK_M 77
-#define VK_META 157
-#define VK_MODECHANGE 31
-#define VK_MULTIPLY 106
-#define VK_N 78
-#define VK_NONCONVERT 29
-#define VK_NUM_LOCK 144
-#define VK_NUMPAD0 96
-#define VK_NUMPAD1 97
-#define VK_NUMPAD2 98
-#define VK_NUMPAD3 99
-#define VK_NUMPAD4 100
-#define VK_NUMPAD5 101
-#define VK_NUMPAD6 102
-#define VK_NUMPAD7 103
-#define VK_NUMPAD8 104
-#define VK_NUMPAD9 105
-#define VK_O 79
-#define VK_OPEN_BRACKET 91
-#define VK_P 80
-#define VK_PAGE_DOWN 34
-#define VK_PAGE_UP 33
-#define VK_PAUSE 19
-#define VK_PERIOD 46
-#define VK_PRINTSCREEN 154
-#define VK_Q 81
-#define VK_QUOTE 222
-#define VK_R 82
-#define VK_RIGHT 39
-#define VK_S 83
-#define VK_SCROLL_LOCK 145
-#define VK_SEMICOLON 59
-#define VK_SEPARATOR 108
-#define VK_SHIFT 16
-#define VK_SLASH 47
-#define VK_SPACE 32
-#define VK_SUBTRACT 109
-#define VK_T 84
-#define VK_TAB 9
-#define VK_U 85
-#define VK_UP 38
-#define VK_V 86
-#define VK_W 87
-#define VK_X 88
-#define VK_Y 89
-#define VK_Z 90
-
-#define AWT_FOCUS_LOST 1004
-#define AWT_FOCUS_GAINED 1005
-
-extern jmethodID postActionEventID;
-extern jmethodID postMenuActionEventID;
-extern jmethodID postMouseEventID;
-extern jmethodID postConfigureEventID;
-extern jmethodID postExposeEventID;
-extern jmethodID postKeyEventID;
-extern jmethodID postFocusEventID;
-extern jmethodID postAdjustmentEventID;
-extern jmethodID postItemEventID;
-extern jmethodID postListItemEventID;
-extern jmethodID syncAttrsID;
-extern jclass gdkColor;
-extern jmethodID gdkColorID;
-extern JNIEnv *gdk_env;
-
-void
-gdk_window_get_root_geometry (GdkWindow *window,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- gint *border,
- gint *depth);
-
-void awt_event_handler (GdkEvent *event);
-
-void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...);
-
-void set_visible (GtkWidget *widget, jboolean visible);
-void set_parent (GtkWidget *widget, GtkContainer *parent);
-GtkLayout *find_gtk_layout (GtkWidget *parent);
-void setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
- jint height, jboolean visible);
-
-struct item_event_hook_info
-{
- jobject peer_obj;
- jobject item_obj;
-};
-
-#endif /* __GTKPEER_H */