summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/gtk_util.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 23:42:40 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 23:42:40 +0000
commit43ecb4443806642bf5f58c55cc06c10882202921 (patch)
tree576c750761c7f6f855913c1a221cf5961cad1304 /chrome/browser/gtk/gtk_util.cc
parent43b0ecbff053d779f5f57a1b2a729ba87f8ab04d (diff)
downloadchromium_src-43ecb4443806642bf5f58c55cc06c10882202921.zip
chromium_src-43ecb4443806642bf5f58c55cc06c10882202921.tar.gz
chromium_src-43ecb4443806642bf5f58c55cc06c10882202921.tar.bz2
gtk: fix setting minimum window size to not produce conflicting info
Before we could potentially set a minimum size greater than the maximum size. Now we take whichever is larger: the size requested in the resources and the actual size of the content. This allows the resource size to grow the window larger without chopping off the content if the content is larger than the specified resources size. BUG=40580 TEST=verified it looked ok in en, pt, and de (all three cases are different) Review URL: http://codereview.chromium.org/2034005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/gtk_util.cc')
-rw-r--r--chrome/browser/gtk/gtk_util.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/gtk/gtk_util.cc
index c170da1..cc22399 100644
--- a/chrome/browser/gtk/gtk_util.cc
+++ b/chrome/browser/gtk/gtk_util.cc
@@ -219,16 +219,21 @@ void SetWindowSizeFromResources(GtkWindow* window,
gtk_window_set_default_size(window, width, height);
} else {
// For a non-resizable window, GTK tries to snap the window size
- // to the minimum size around the content. We still want to set
- // the *minimum* window size to allow windows with long titles to
- // be wide enough to display their titles, but if GTK needs to
- // make the window *wider* due to very wide controls, we should
- // allow that too.
- GdkGeometry geometry;
- geometry.min_width = width;
- geometry.min_height = height;
- gtk_window_set_geometry_hints(window, GTK_WIDGET(window),
- &geometry, GDK_HINT_MIN_SIZE);
+ // to the minimum size around the content. We use the sizes in
+ // the resources to set *minimum* window size to allow windows
+ // with long titles to be wide enough to display their titles.
+ //
+ // But if GTK wants to make the window *wider* due to very wide
+ // controls, we should allow that too, so be careful to pick the
+ // wider of the resources size and the natural window size.
+
+ gtk_widget_show_all(GTK_BIN(window)->child);
+ GtkRequisition requisition;
+ gtk_widget_size_request(GTK_WIDGET(window), &requisition);
+ gtk_widget_set_size_request(
+ GTK_WIDGET(window),
+ width == -1 ? -1 : std::max(width, requisition.width),
+ height == -1 ? -1 : std::max(height, requisition.height));
}
gtk_window_set_resizable(window, resizable ? TRUE : FALSE);
}