summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2005-09-20 18:46:20 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2005-09-20 18:46:20 +0000
commit3baed5090a8b63218fd8a5808cd38caeb79a0f7d (patch)
treee3d5427d27e9ef1ebb9de69a3fd3639084d196d1 /native
parentd30cf1c6c0de86bac88773529f7071497ce18916 (diff)
downloadclasspath-3baed5090a8b63218fd8a5808cd38caeb79a0f7d.tar.gz
2005-09-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of generics-branch for 2005/09/07 - 2005/09/20 @ 10:05am GMT.
Diffstat (limited to 'native')
-rw-r--r--native/fdlibm/mprec.h5
-rw-r--r--native/jawt/jawt.c4
-rw-r--r--native/jni/classpath/jcl.c16
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c29
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c95
-rw-r--r--native/jni/gtk-peer/gtkpeer.h11
-rw-r--r--native/jni/java-net/java_net_VMInetAddress.c3
-rw-r--r--native/jni/java-net/javanet.c8
9 files changed, 57 insertions, 116 deletions
diff --git a/native/fdlibm/mprec.h b/native/fdlibm/mprec.h
index d796b81de..f250619b0 100644
--- a/native/fdlibm/mprec.h
+++ b/native/fdlibm/mprec.h
@@ -291,7 +291,12 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
#define MAX_BIGNUMS 16
+#ifdef Pack_32
#define MAX_BIGNUM_WDS 32
+#else
+ /* Note that this is a workaround for */
+#define MAX_BIGNUM_WDS 128
+#endif
struct _Jv_Bigint
{
diff --git a/native/jawt/jawt.c b/native/jawt/jawt.c
index 6d26a0da9..a41786850 100644
--- a/native/jawt/jawt.c
+++ b/native/jawt/jawt.c
@@ -176,11 +176,11 @@ static void
static void
(JNICALL _Jv_AWTLock) (JNIEnv* env __attribute__((unused)))
{
- classpath_jawt_lock ();
+ /* FIXME: what is this supposed to do? */
}
static void
(JNICALL _Jv_AWTUnlock) (JNIEnv* env __attribute__((unused)))
{
- classpath_jawt_unlock ();
+ /* FIXME: what is this supposed to do? */
}
diff --git a/native/jni/classpath/jcl.c b/native/jni/classpath/jcl.c
index 4821770ed..aacbe8900 100644
--- a/native/jni/classpath/jcl.c
+++ b/native/jni/classpath/jcl.c
@@ -1,5 +1,5 @@
/* jcl.c
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -193,7 +193,8 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
{
if (rawDataClass == NULL)
{
-#ifdef POINTERS_ARE_64BIT
+ jclass tmp;
+#if SIZEOF_VOID_P == 8
rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
if (rawDataClass == NULL)
{
@@ -243,17 +244,18 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
}
#endif
- (*env)->DeleteLocalRef(env, rawDataClass);
- rawDataClass = (*env)->NewGlobalRef (env, rawDataClass);
- if (rawDataClass == NULL)
+ tmp = (*env)->NewGlobalRef (env, rawDataClass);
+ if (tmp == NULL)
{
JCL_ThrowException (env, "java/lang/InternalError",
"unable to create an internal global ref");
return NULL;
}
+ (*env)->DeleteLocalRef(env, rawDataClass);
+ rawDataClass = tmp;
}
-#ifdef POINTERS_ARE_64BIT
+#if SIZEOF_VOID_P == 8
return (*env)->NewObject (env, rawDataClass, rawData_mid, (jlong) data);
#else
return (*env)->NewObject (env, rawDataClass, rawData_mid, (jint) data);
@@ -263,7 +265,7 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
JNIEXPORT void * JNICALL
JCL_GetRawData (JNIEnv * env, jobject rawdata)
{
-#ifdef POINTERS_ARE_64BIT
+#if SIZEOF_VOID_P == 8
return (void *) (*env)->GetLongField (env, rawdata, rawData_fid);
#else
return (void *) (*env)->GetIntField (env, rawdata, rawData_fid);
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 6f2a1ae72..ce65a1994 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -98,7 +98,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
pfont = (struct peerfont *)NSA_DEL_FONT_PTR (env, self);
g_assert (pfont != NULL);
if (pfont->layout != NULL)
- g_object_unref (pfont->font);
+ g_object_unref (pfont->layout);
if (pfont->font != NULL)
g_object_unref (pfont->font);
if (pfont->ctx != NULL)
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index f832da5a4..684deeb84 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -56,10 +56,6 @@ exception statement from your version. */
#define AWT_HAND_CURSOR 12
#define AWT_MOVE_CURSOR 13
-#define AWT_BUTTON1_DOWN_MASK (1 << 10)
-#define AWT_BUTTON2_DOWN_MASK (1 << 11)
-#define AWT_BUTTON3_DOWN_MASK (1 << 12)
-
/* FIXME: use gtk-double-click-time, gtk-double-click-distance */
#define MULTI_CLICK_TIME 250
/* as opposed to a MULTI_PASS_TIME :) */
@@ -135,11 +131,11 @@ button_to_awt_mods (int button)
switch (button)
{
case 1:
- return AWT_BUTTON1_MASK;
+ return AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
case 2:
- return AWT_BUTTON2_MASK;
+ return AWT_BUTTON2_DOWN_MASK | AWT_BUTTON2_MASK;
case 3:
- return AWT_BUTTON3_MASK;
+ return AWT_BUTTON3_DOWN_MASK | AWT_BUTTON3_MASK;
}
return 0;
@@ -151,11 +147,11 @@ cp_gtk_state_to_awt_mods (guint state)
jint result = 0;
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= (AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK);
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= (AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK);
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= (AWT_ALT_DOWN_MASK | AWT_ALT_MASK);
return result;
}
@@ -166,13 +162,13 @@ state_to_awt_mods_with_button_states (guint state)
jint result = 0;
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
if (state & GDK_BUTTON1_MASK)
- result |= AWT_BUTTON1_DOWN_MASK;
+ result |= AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
if (state & GDK_BUTTON2_MASK)
result |= AWT_BUTTON2_DOWN_MASK;
if (state & GDK_BUTTON3_MASK)
@@ -766,7 +762,10 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isRealized
ptr = NSA_GET_PTR (env, obj);
if (ptr == NULL)
- return FALSE;
+ {
+ gdk_threads_leave ();
+ return FALSE;
+ }
ret_val = GTK_WIDGET_REALIZED (GTK_WIDGET (ptr));
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 0f623d165..e5262957e 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -952,29 +952,29 @@ keyevent_state_to_awt_mods (GdkEventKey *event)
if (event->keyval == GDK_Shift_L
|| event->keyval == GDK_Shift_R)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
else
{
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
}
if (event->keyval == GDK_Control_L
|| event->keyval == GDK_Control_R)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
else
{
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
}
if (event->keyval == GDK_Alt_L
|| event->keyval == GDK_Alt_R)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
else
{
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
}
}
else if (event->type == GDK_KEY_RELEASE)
@@ -985,20 +985,20 @@ keyevent_state_to_awt_mods (GdkEventKey *event)
&& event->keyval != GDK_Shift_R)
{
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
}
if (event->keyval != GDK_Control_L
&& event->keyval != GDK_Control_R)
{
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
}
if (event->keyval != GDK_Alt_L
&& event->keyval != GDK_Alt_R)
{
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
}
}
@@ -1028,9 +1028,6 @@ static gboolean window_delete_cb (GtkWidget *widget, GdkEvent *event,
static void window_destroy_cb (GtkWidget *widget, GdkEvent *event,
jobject peer);
static void window_show_cb (GtkWidget *widget, jobject peer);
-static void window_active_state_change_cb (GtkWidget *widget,
- GParamSpec *pspec,
- jobject peer);
static void window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec,
jobject peer);
@@ -1043,7 +1040,6 @@ static gboolean window_focus_out_cb (GtkWidget * widget,
static gboolean window_window_state_cb (GtkWidget *widget,
GdkEvent *event,
jobject peer);
-static jint window_get_new_state (GtkWidget *widget);
static gboolean window_property_changed_cb (GtkWidget *widget,
GdkEventProperty *event,
jobject peer);
@@ -1278,9 +1274,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
g_signal_connect (G_OBJECT (ptr), "show",
G_CALLBACK (window_show_cb), *gref);
- g_signal_connect (G_OBJECT (ptr), "notify::is-active",
- G_CALLBACK (window_active_state_change_cb), *gref);
-
g_signal_connect (G_OBJECT (ptr), "notify::has-toplevel-focus",
G_CALLBACK (window_focus_state_change_cb), *gref);
@@ -1592,31 +1585,6 @@ window_show_cb (GtkWidget *widget __attribute__((unused)),
}
static void
-window_active_state_change_cb (GtkWidget *widget __attribute__((unused)),
- GParamSpec *pspec __attribute__((unused)),
- jobject peer __attribute__((unused)))
-{
- /* FIXME: not sure if this is needed or not. */
- /* Remove the unused attributes if you fix the below. */
-#if 0
- gdk_threads_leave ();
-
- if (GTK_WINDOW (widget)->is_active)
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- postWindowEventID,
- (jint) AWT_WINDOW_GAINED_FOCUS,
- (jobject) NULL, (jint) 0);
- else
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- postWindowEventID,
- (jint) AWT_WINDOW_DEACTIVATED,
- (jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
-#endif
-}
-
-static void
window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec __attribute__((unused)),
jobject peer)
@@ -1660,7 +1628,7 @@ window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
}
static gboolean
-window_window_state_cb (GtkWidget *widget,
+window_window_state_cb (GtkWidget *widget __attribute__((unused)),
GdkEvent *event,
jobject peer)
{
@@ -1695,8 +1663,6 @@ window_window_state_cb (GtkWidget *widget,
if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
new_state |= AWT_FRAME_STATE_ICONIFIED;
- new_state |= window_get_new_state (widget);
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_STATE_CHANGED,
@@ -1705,47 +1671,6 @@ window_window_state_cb (GtkWidget *widget,
return TRUE;
}
-static jint
-window_get_new_state (GtkWidget *widget)
-{
- GdkDisplay *display = gtk_widget_get_display(widget);
- jint new_state = AWT_FRAME_STATE_NORMAL;
- Atom type;
- gint format;
- gulong atom_count;
- gulong bytes_after;
- Atom *atom_list = NULL;
- union atom_list_union alu;
- gulong i;
-
- alu.atom_list = &atom_list;
- XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XID (widget->window),
- gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
- 0, G_MAXLONG, False, XA_ATOM, &type, &format, &atom_count,
- &bytes_after, alu.gu_extents);
-
- if (type != None)
- {
- Atom maxvert = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT");
- Atom maxhorz = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
-
- i = 0;
- while (i < atom_count)
- {
- if (atom_list[i] == maxhorz)
- new_state |= AWT_FRAME_STATE_MAXIMIZED_HORIZ;
- else if (atom_list[i] == maxvert)
- new_state |= AWT_FRAME_STATE_MAXIMIZED_VERT;
-
- ++i;
- }
-
- XFree (atom_list);
- }
- return new_state;
-}
-
static gboolean
window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
GdkEventProperty *event,
diff --git a/native/jni/gtk-peer/gtkpeer.h b/native/jni/gtk-peer/gtkpeer.h
index 2b16d99b4..f332b62a1 100644
--- a/native/jni/gtk-peer/gtkpeer.h
+++ b/native/jni/gtk-peer/gtkpeer.h
@@ -111,15 +111,26 @@ struct graphics
jint x_offset, y_offset;
};
+/* New-style event masks. */
+#define AWT_BUTTON1_DOWN_MASK (1 << 10)
+#define AWT_BUTTON2_DOWN_MASK (1 << 11)
+#define AWT_BUTTON3_DOWN_MASK (1 << 12)
+
#define AWT_SHIFT_DOWN_MASK (1 << 6)
#define AWT_CTRL_DOWN_MASK (1 << 7)
#define AWT_META_DOWN_MASK (1 << 8)
#define AWT_ALT_DOWN_MASK (1 << 9)
+/* Old-style event masks. */
#define AWT_BUTTON1_MASK (1 << 4)
#define AWT_BUTTON2_MASK (1 << 3)
#define AWT_BUTTON3_MASK (1 << 2)
+#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_ITEM_SELECTED 1
#define AWT_ITEM_DESELECTED 2
diff --git a/native/jni/java-net/java_net_VMInetAddress.c b/native/jni/java-net/java_net_VMInetAddress.c
index d33265cff..0ba00d1c3 100644
--- a/native/jni/java-net/java_net_VMInetAddress.c
+++ b/native/jni/java-net/java_net_VMInetAddress.c
@@ -181,7 +181,8 @@ Java_java_net_VMInetAddress_getHostByAddr (JNIEnv * env,
sizeof (hostname), result);
if (result != TARGET_NATIVE_OK)
{
- JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Bad IP address");
+ JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
return (jstring) NULL;
}
diff --git a/native/jni/java-net/javanet.c b/native/jni/java-net/javanet.c
index fdc1c22ec..51c58a921 100644
--- a/native/jni/java-net/javanet.c
+++ b/native/jni/java-net/javanet.c
@@ -857,7 +857,7 @@ _javanet_accept (JNIEnv * env, jobject this, jobject impl)
!= TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
{
JCL_ThrowException (env, IO_EXCEPTION,
- "Internal error: _javanet_accept(): ");
+ TARGET_NATIVE_LAST_ERROR_STRING ());
return;
}
}
@@ -1542,8 +1542,7 @@ _javanet_shutdownInput (JNIEnv * env, jobject this)
/* Shutdown input stream of socket. */
if (shutdown (fd, SHUT_RD) == -1)
{
- JCL_ThrowException (env, SOCKET_EXCEPTION,
- "Can't shutdown input of socket");
+ JCL_ThrowException (env, SOCKET_EXCEPTION, strerror (errno));
return;
}
}
@@ -1568,8 +1567,7 @@ _javanet_shutdownOutput (JNIEnv * env, jobject this)
/* Shutdown output stream of socket. */
if (shutdown (fd, SHUT_WR) == -1)
{
- JCL_ThrowException (env, SOCKET_EXCEPTION,
- "Can't shutdown output of socket");
+ JCL_ThrowException (env, SOCKET_EXCEPTION, strerror (errno));
return;
}
}