[kaffe] CVS kaffe (robilad): Resynced with GNU classpath: awt fixes from fitzsim
Kaffe CVS
cvs-commits at kaffe.org
Wed Feb 23 13:21:12 PST 2005
PatchSet 5598
Date: 2005/02/23 21:15:04
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU classpath: awt fixes from fitzsim
2005-02-23 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-02-22 Thomas Fitzsimmons <fitzsim at redhat.com>
* gnu/java/awt/peer/gtk/GtkWindowPeer.java,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(getWidth): New method.
(getHeight): Likewise.
(create): Remove width, height and insets parameters. Move size
setup ...
(realize_cb): ... here. New function.
(connectSignals): Connect realize_cb.
(request_frame_extents): Remove FIXME. Move
postInsetsChangedEvent lookup ...
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (gtkInit):
... here. Look up GtkWindowPeer getWidth and getHeight methods.
* jni/gtk-peer/gtkpeer.h (postInsetsChangedEventID): Declare
jmethodID.
(windowGetWidthID): Likewise.
(windowGetHeightID): Likewise.
Members:
ChangeLog:1.3643->1.3644
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:1.7->1.8
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:1.13->1.14
libraries/clib/awt/classpath-gtk/gtk-peer/gtkpeer.h:1.9->1.10
libraries/javalib/gnu/java/awt/peer/gtk/GtkWindowPeer.java:1.8->1.9
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3643 kaffe/ChangeLog:1.3644
--- kaffe/ChangeLog:1.3643 Wed Feb 23 21:02:30 2005
+++ kaffe/ChangeLog Wed Feb 23 21:15:04 2005
@@ -4,6 +4,29 @@
2005-02-22 Thomas Fitzsimmons <fitzsim at redhat.com>
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (getWidth): New method.
+ (getHeight): Likewise.
+ (create): Remove width, height and insets parameters. Move size
+ setup ...
+ (realize_cb): ... here. New function.
+ (connectSignals): Connect realize_cb.
+ (request_frame_extents): Remove FIXME. Move
+ postInsetsChangedEvent lookup ...
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (gtkInit):
+ ... here. Look up GtkWindowPeer getWidth and getHeight methods.
+ * jni/gtk-peer/gtkpeer.h (postInsetsChangedEventID): Declare
+ jmethodID.
+ (windowGetWidthID): Likewise.
+ (windowGetHeightID): Likewise.
+
+2005-02-23 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
+ 2005-02-22 Thomas Fitzsimmons <fitzsim at redhat.com>
+
* java/awt/Robot.java (waitForIdle): Call invokeAndWait on an
empty Runnable.
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:1.7 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:1.8
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:1.7 Mon Feb 14 13:48:38 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c Wed Feb 23 21:15:08 2005
@@ -62,6 +62,9 @@
jmethodID postListItemEventID;
jmethodID postTextEventID;
jmethodID postWindowEventID;
+jmethodID postInsetsChangedEventID;
+jmethodID windowGetWidthID;
+jmethodID windowGetHeightID;
jmethodID beginNativeRepaintID;
jmethodID endNativeRepaintID;
@@ -219,6 +222,14 @@
postWindowEventID = (*env)->GetMethodID (env, gtkwindowpeer,
"postWindowEvent",
"(ILjava/awt/Window;I)V");
+ postInsetsChangedEventID = (*env)->GetMethodID (env, gtkwindowpeer,
+ "postInsetsChangedEvent",
+ "(IIII)V");
+ windowGetWidthID = (*env)->GetMethodID (env, gtkwindowpeer,
+ "getWidth", "()I");
+ windowGetHeightID = (*env)->GetMethodID (env, gtkwindowpeer,
+ "getHeight", "()I");
+
postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
"postExposeEvent", "(IIII)V");
postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:1.13 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:1.14
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c:1.13 Sun Feb 13 22:32:12 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c Wed Feb 23 21:15:08 2005
@@ -80,6 +80,7 @@
static gboolean window_property_changed_cb (GtkWidget *widget,
GdkEventProperty *event,
jobject peer);
+static void realize_cb (GtkWidget *widget, jobject peer);
/* Union used for type punning. */
union extents_union
@@ -94,23 +95,14 @@
Atom **atom_list;
};
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
- (JNIEnv *env, jobject obj, jint type, jboolean decorated,
- jint width, jint height, jobject parent, jintArray jinsets)
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
+ (JNIEnv *env, jobject obj, jint type, jboolean decorated, jobject parent)
{
GtkWidget *window_widget;
GtkWindow *window;
void *window_parent;
GtkWidget *fixed;
- int top = 0;
- int left = 0;
- int bottom = 0;
- int right = 0;
- jint *insets;
-
- insets = (*env)->GetIntArrayElements (env, jinsets, NULL);
- insets[0] = insets[1] = insets[2] = insets[3] = 0;
NSA_SET_GLOBAL_REF (env, obj);
@@ -137,31 +129,8 @@
gtk_widget_show (fixed);
- if (decorated)
- window_get_frame_extents (window_widget, &top, &left, &bottom, &right);
-
- gtk_window_set_default_size (window,
- MAX (1, width - left - right),
- MAX (1, height - top - bottom));
-
- /* We must set this window's size requisition. Otherwise when a
- resize is queued (when gtk_widget_queue_resize is called) the
- window will snap to its default requisition of 0x0. If we omit
- this call, Frames and Dialogs shrink to degenerate 1x1 windows
- when their resizable property changes. */
- gtk_widget_set_size_request (window_widget,
- MAX (1, width - left - right),
- MAX (1, height - top - bottom));
-
- insets[0] = top;
- insets[1] = left;
- insets[2] = bottom;
- insets[3] = right;
-
gdk_threads_leave ();
- (*env)->ReleaseIntArrayElements (env, jinsets, insets, 0);
-
NSA_SET_PTR (env, obj, window_widget);
}
@@ -278,6 +247,9 @@
G_CALLBACK (window_property_changed_cb), *gref);
g_signal_connect_after (G_OBJECT (ptr), "realize",
+ G_CALLBACK (realize_cb), *gref);
+
+ g_signal_connect_after (G_OBJECT (ptr), "realize",
G_CALLBACK (connect_awt_hook_cb), *gref);
gdk_threads_leave ();
@@ -428,9 +400,7 @@
/* Check if the current window manager supports
_NET_REQUEST_FRAME_EXTENTS. */
- /* FIXME: The window->window != NULL check is a workaround for bug
- http://bugzilla.gnome.org/show_bug.cgi?id=17952. */
- if (gdk_net_wm_supports (request_extents) && window->window != NULL)
+ if (gdk_net_wm_supports (request_extents))
{
GdkDisplay *display = gtk_widget_get_display (window);
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
@@ -700,19 +670,6 @@
unsigned long *extents;
union extents_union gu_ex;
- static int id_set = 0;
- static jmethodID postInsetsChangedEventID;
-
- if (!id_set)
- {
- jclass gtkwindowpeer = (*gdk_env())->FindClass (gdk_env(),
- "gnu/java/awt/peer/gtk/GtkWindowPeer");
- postInsetsChangedEventID = (*gdk_env())->GetMethodID (gdk_env(),
- gtkwindowpeer,
- "postInsetsChangedEvent",
- "(IIII)V");
- id_set = 1;
- }
gu_ex.extents = &extents;
if (gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE) == event->atom
&& gdk_property_get (event->window,
@@ -738,4 +695,37 @@
return FALSE;
+}
+
+static void
+realize_cb (GtkWidget *widget, jobject peer)
+{
+ jint top = 0;
+ jint left = 0;
+ jint bottom = 0;
+ jint right = 0;
+ jint width = 0;
+ jint height = 0;
+
+ width = (*gdk_env())->CallIntMethod (gdk_env(), peer, windowGetWidthID);
+ height = (*gdk_env())->CallIntMethod (gdk_env(), peer, windowGetHeightID);
+
+ window_get_frame_extents (widget, &top, &left, &bottom, &right);
+
+ (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+ postInsetsChangedEventID,
+ top, left, bottom, right);
+
+ gtk_window_set_default_size (GTK_WINDOW (widget),
+ MAX (1, width - left - right),
+ MAX (1, height - top - bottom));
+
+ /* set the size like we do in nativeSetBounds */
+ gtk_widget_set_size_request (widget,
+ MAX (1, width - left - right),
+ MAX (1, height - top - bottom));
+
+ gtk_window_resize (GTK_WINDOW (widget),
+ MAX (1, width - left - right),
+ MAX (1, height - top - bottom));
}
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtkpeer.h
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtkpeer.h:1.9 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtkpeer.h:1.10
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtkpeer.h:1.9 Sat Jan 22 18:49:11 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gtkpeer.h Wed Feb 23 21:15:08 2005
@@ -465,6 +465,10 @@
extern jclass gdkColor;
extern jmethodID gdkColorID;
+extern jmethodID postInsetsChangedEventID;
+extern jmethodID windowGetWidthID;
+extern jmethodID windowGetHeightID;
+
JNIEnv *gdk_env(void);
extern double dpi_conversion_factor;
Index: kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkWindowPeer.java
diff -u kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkWindowPeer.java:1.8 kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkWindowPeer.java:1.9
--- kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkWindowPeer.java:1.8 Sat Feb 19 15:30:28 2005
+++ kaffe/libraries/javalib/gnu/java/awt/peer/gtk/GtkWindowPeer.java Wed Feb 23 21:15:08 2005
@@ -63,30 +63,27 @@
native void gtkWindowSetResizable (boolean resizable);
native void gtkWindowSetModal (boolean modal);
- native void create (int type, boolean decorated,
- int width, int height,
- GtkWindowPeer parent,
- int[] insets);
+ int getWidth ()
+ {
+ return awtComponent.getWidth();
+ }
+
+ int getHeight ()
+ {
+ return awtComponent.getHeight();
+ }
+
+ native void create (int type, boolean decorated, GtkWindowPeer parent);
void create (int type, boolean decorated)
{
GtkWindowPeer parent_peer = null;
Component parent = awtComponent.getParent();
- int[] insets = new int [] { 0, 0, 0, 0 };
if (parent != null)
parent_peer = (GtkWindowPeer) awtComponent.getParent().getPeer();
- create (type, decorated,
- awtComponent.getWidth(),
- awtComponent.getHeight(),
- parent_peer,
- insets);
-
- this.insets.top = insets [0];
- this.insets.left = insets [1];
- this.insets.bottom = insets [2];
- this.insets.right = insets [3];
+ create (type, decorated, parent_peer);
}
void create ()
More information about the kaffe
mailing list