summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/tab_contents_container_gtk.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 19:19:27 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-03 19:19:27 +0000
commit99d5f339101b38d3f0cd921768e24029882d4f17 (patch)
tree7ceae71831d0c90165705156f89425cd5d0fe224 /chrome/browser/gtk/tab_contents_container_gtk.cc
parent31771fa8acaa89d16e3ffad2974d67fba9c18f75 (diff)
downloadchromium_src-99d5f339101b38d3f0cd921768e24029882d4f17.zip
chromium_src-99d5f339101b38d3f0cd921768e24029882d4f17.tar.gz
chromium_src-99d5f339101b38d3f0cd921768e24029882d4f17.tar.bz2
Convert tabcontentscontainer to use a vbox instead of a fixed. The
comment in the code mentions that a vbox would cause a split screen, but looking at the code, it seems like that's not possible because we hide the old TCVG before adding new ones. These days the vbox contains all TCVGs and only shows one at a time (I think in the past we tried to remove them, but we don't have that problem now). This simplifies the code by not having to use our own size-allocate handler. Review URL: http://codereview.chromium.org/354018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/tab_contents_container_gtk.cc')
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.cc45
1 files changed, 8 insertions, 37 deletions
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc
index 9425194..c106ace 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.cc
+++ b/chrome/browser/gtk/tab_contents_container_gtk.cc
@@ -12,24 +12,6 @@
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#include "chrome/common/notification_service.h"
-namespace {
-
-// Allocates all normal tab contents views to the size of the passed in
-// |allocation|.
-void ResizeChildren(GtkWidget* widget, void* param) {
- GtkAllocation* allocation = reinterpret_cast<GtkAllocation*>(param);
- if (!GTK_WIDGET_VISIBLE(widget))
- return;
-
- if (widget->allocation.width != allocation->width ||
- widget->allocation.height != allocation->height) {
- gtk_widget_set_size_request(widget, allocation->width,
- allocation->height);
- }
-}
-
-} // namespace
-
TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble)
: tab_contents_(NULL),
status_bubble_(status_bubble) {
@@ -44,7 +26,7 @@ void TabContentsContainerGtk::Init() {
// A high level overview of the TabContentsContainer:
//
// +- GtkFloatingContainer |floating_| -------------------------------+
- // |+- GtkFixedContainer |fixed_| -----------------------------------+|
+ // |+- GtkVBox |container_| -----------------------------------------+|
// || ||
// || ||
// || ||
@@ -57,10 +39,8 @@ void TabContentsContainerGtk::Init() {
floating_.Own(gtk_floating_container_new());
gtk_widget_set_name(floating_.get(), "chrome-tab-contents-container");
- fixed_ = gtk_fixed_new();
- g_signal_connect(fixed_, "size-allocate",
- G_CALLBACK(OnFixedSizeAllocate), this);
- gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_);
+ container_ = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(floating_.get()), container_);
if (status_bubble_) {
gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()),
@@ -69,7 +49,7 @@ void TabContentsContainerGtk::Init() {
G_CALLBACK(OnSetFloatingPosition), this);
}
- gtk_widget_show(fixed_);
+ gtk_widget_show(container_);
gtk_widget_show(floating_.get());
ViewIDUtil::SetDelegateForWidget(widget(), this);
@@ -105,8 +85,8 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
gfx::NativeView widget = tab_contents_->GetNativeView();
if (widget) {
- if (widget->parent != fixed_)
- gtk_fixed_put(GTK_FIXED(fixed_), widget, 0, 0);
+ if (widget->parent != container_)
+ gtk_container_add(GTK_CONTAINER(container_), widget);
gtk_widget_show(widget);
}
@@ -127,8 +107,8 @@ void TabContentsContainerGtk::DetachTabContents(TabContents* tab_contents) {
// It is possible to detach an unrealized, unparented TabContents if you
// slow things down enough in valgrind. Might happen in the real world, too.
if (widget && widget->parent) {
- DCHECK_EQ(widget->parent, fixed_);
- gtk_container_remove(GTK_CONTAINER(fixed_), widget);
+ DCHECK_EQ(widget->parent, container_);
+ gtk_container_remove(GTK_CONTAINER(container_), widget);
}
}
@@ -176,15 +156,6 @@ GtkWidget* TabContentsContainerGtk::GetWidgetForViewID(ViewID view_id) {
// -----------------------------------------------------------------------------
// static
-void TabContentsContainerGtk::OnFixedSizeAllocate(
- GtkWidget* fixed,
- GtkAllocation* allocation,
- TabContentsContainerGtk* container) {
- // Set all the tab contents GtkWidgets to the size of the allocation.
- gtk_container_foreach(GTK_CONTAINER(fixed), ResizeChildren, allocation);
-}
-
-// static
void TabContentsContainerGtk::OnSetFloatingPosition(
GtkFloatingContainer* floating_container, GtkAllocation* allocation,
TabContentsContainerGtk* tab_contents_container) {