GtkComponentPeer.java (GtkComponentPeer): If it is a FileDialog and has dimensions of 0 by 0...

2004-01-16  Kim Ho  <kho@redhat.com>

        * gnu/java/awt/peer/gtk/GtkComponentPeer.java (GtkComponentPeer): If
        it is a FileDialog and has dimensions of 0 by 0, then the initial
        size is set to size request plus insets.
        * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
        (gtkWidgetGetDimensions): Override method.
        * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
        (gtkWidgetGetDimensions): Override method. Returns size request plus
        insets.

From-SVN: r75993
This commit is contained in:
Kim Ho 2004-01-16 20:05:41 +00:00 committed by Kim Ho
parent 79a76d653a
commit 2b8deefadd
4 changed files with 52 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2004-01-16 Kim Ho <kho@redhat.com>
* gnu/java/awt/peer/gtk/GtkComponentPeer.java (GtkComponentPeer): If
it is a FileDialog and has dimensions of 0 by 0, then the initial
size is set to size request plus insets.
* gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
(gtkWidgetGetDimensions): Override method.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(gtkWidgetGetDimensions): Override method. Returns size request plus
insets.
2004-01-16 Andrew Haley <aph@redhat.com>
* sysdep/x86-64/locks.h: Don't use in/out memory constraints.

View File

@ -1,5 +1,5 @@
/* GtkComponentPeer.java -- Implements ComponentPeer with GTK
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -124,6 +124,16 @@ public class GtkComponentPeer extends GtkGenericPeer
setFont(awtComponent.getFont());
setCursor (awtComponent.getCursor ());
if (this instanceof GtkFileDialogPeer && awtComponent.getHeight() == 0
&& awtComponent.getWidth() == 0)
{
int[] dims = new int[2];
gtkWidgetGetDimensions(dims);
((GtkFileDialogPeer) this).setBoundsCallback((Window)awtComponent,
awtComponent.getX(),
awtComponent.getY(),
dims[0], dims[1]);
}
Rectangle bounds = awtComponent.getBounds ();
setBounds (bounds.x, bounds.y, bounds.width, bounds.height);

View File

@ -1,5 +1,5 @@
/* GtkFileDialogPeer.java -- Implements FileDialogPeer with GTK
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -63,6 +63,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
native void connectJObject ();
native void connectSignals ();
native void nativeSetFile (String file);
native void gtkWidgetGetDimensions (int[] dims);
public void setFile (String fileName)
{

View File

@ -1,5 +1,5 @@
/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -400,6 +400,33 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
return height;
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_gtkWidgetGetDimensions
(JNIEnv *env, jobject obj, jintArray jdims)
{
void *ptr;
jint *dims;
int top, left, bottom, right;
GtkRequisition req;
ptr = NSA_GET_PTR (env, obj);
dims = (*env)->GetIntArrayElements (env, jdims, 0);
dims[0] = dims[1] = 0;
gdk_threads_enter ();
gtk_widget_size_request (GTK_WIDGET (ptr), &req);
window_get_frame_extents (GTK_WIDGET (ptr), &top, &left, &bottom, &right);
dims[0] = req.width + left + right;
dims[1] = req.height + top + bottom;
gdk_threads_leave ();
(*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
}
static void
window_get_frame_extents (GtkWidget *window,
int *top, int *left, int *bottom, int *right)