]> khamidou — GitHub mirrors - electron.git/commitdiff
gtk: Force size allocation in window, fixes #219.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 28 Mar 2014 08:01:38 +0000 (16:01 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 28 Mar 2014 08:01:38 +0000 (16:01 +0800)
atom/browser/native_window_gtk.cc

index 50eeebf731203f928c439f7b2d735958e5d0d6fc..e1b7bddb057c567b3720847a0ee6c85bb4f783d0 100644 (file)
@@ -52,6 +52,12 @@ NativeWindowGtk::NativeWindowGtk(content::WebContents* web_contents,
   options->GetInteger(switches::kHeight, &height);
   SetSize(gfx::Size(width, height));
 
+  // Force a size allocation so the web page of hidden window can have correct
+  // value of $(window).width().
+  GtkAllocation size = { 0, 0, width, height };
+  gtk_widget_show_all(vbox_);
+  gtk_widget_size_allocate(GTK_WIDGET(window_), &size);
+
   if (!icon_.IsEmpty())
     gtk_window_set_icon(window_, icon_.ToGdkPixbuf());