diff options
author | Mark Wielaard <mark@klomp.org> | 2004-07-31 21:28:31 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2004-07-31 21:28:31 +0000 |
commit | 3ad2af505dc360340548021ee2cacdf4b0ef2e6d (patch) | |
tree | 802e74908efe76494bd06a16cfac591627431d0d /native/jni | |
parent | 4d04c2bed4e3e0b5b0633c676401d79af66e876d (diff) | |
download | classpath-3ad2af505dc360340548021ee2cacdf4b0ef2e6d.tar.gz |
2004-07-31 David Jee <djee@redhat.com>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
(gtkWidgetGetPreferredDimensions): For widgets extending GtkWindow,
use their default sizes rather than their natural requisitions.
Diffstat (limited to 'native/jni')
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c | 34 |
1 files changed, 24 insertions, 10 deletions
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 352285134..8aaf0d262 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 @@ -737,19 +737,33 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions gdk_threads_enter (); - /* Save the widget's current size request. */ - gtk_widget_size_request (GTK_WIDGET (ptr), ¤t_req); + /* Widgets that extend GtkWindow such as GtkFileChooserDialog may have + a default size. These values seem more useful then the natural + requisition values, particularly for GtkFileChooserDialog. */ + if (GTK_IS_WINDOW (ptr)) + { + gint width, height; + gtk_window_get_default_size (GTK_WINDOW (ptr), &width, &height); + + dims[0] = width; + dims[1] = height; + } + else + { + /* Save the widget's current size request. */ + gtk_widget_size_request (GTK_WIDGET (ptr), ¤t_req); - /* Get the widget's "natural" size request. */ - gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1); - gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req); + /* Get the widget's "natural" size request. */ + gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1); + gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req); - /* Reset the widget's size request. */ - gtk_widget_set_size_request (GTK_WIDGET (ptr), - current_req.width, current_req.height); + /* Reset the widget's size request. */ + gtk_widget_set_size_request (GTK_WIDGET (ptr), + current_req.width, current_req.height); - dims[0] = natural_req.width; - dims[1] = natural_req.height; + dims[0] = natural_req.width; + dims[1] = natural_req.height; + } gdk_threads_leave (); |