Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: views/widget/widget_gtk.cc

Issue 149111: Makes WidgetGtk specify a size before realizing the window. Without... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/widget_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/widget_gtk.cc
===================================================================
--- views/widget/widget_gtk.cc (revision 19366)
+++ views/widget/widget_gtk.cc (working copy)
@@ -87,7 +87,7 @@
#endif
// Make container here.
- CreateGtkWidget(parent);
+ CreateGtkWidget(parent, bounds);
// Make sure we receive our motion events.
@@ -403,7 +403,7 @@
////////////////////////////////////////////////////////////////////////////////
// TODO(beng): organize into sections:
-void WidgetGtk::CreateGtkWidget(GtkWidget* parent) {
+void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) {
if (type_ == TYPE_CHILD) {
window_contents_ = widget_ = gtk_fixed_new();
gtk_fixed_set_has_window(GTK_FIXED(widget_), true);
@@ -418,6 +418,14 @@
} else {
widget_ = gtk_window_new(
type_ == TYPE_WINDOW ? GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP);
+
+ if (!bounds.size().IsEmpty()) {
+ // When we realize the window, the window manager is given a size. If we
+ // don't specify a size before then GTK defaults to 200x200. Specify
+ // a size now so that the window manager sees the requested size.
+ GtkAllocation alloc = { 0, 0, bounds.width(), bounds.height() };
+ gtk_widget_size_allocate(widget_, &alloc);
+ }
gtk_window_set_decorated(GTK_WINDOW(widget_), false);
// We'll take care of positioning our window.
gtk_window_set_position(GTK_WINDOW(widget_), GTK_WIN_POS_NONE);
« no previous file with comments | « views/widget/widget_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698