| Index: chrome/browser/gtk/slide_animator_gtk.cc
|
| ===================================================================
|
| --- chrome/browser/gtk/slide_animator_gtk.cc (revision 34954)
|
| +++ chrome/browser/gtk/slide_animator_gtk.cc (working copy)
|
| @@ -8,20 +8,14 @@
|
| #include "app/slide_animation.h"
|
| #include "base/logging.h"
|
|
|
| -#include "chrome/browser/gtk/gtk_expanded_container.h"
|
| -
|
| namespace {
|
|
|
| -void OnChildSizeRequest(GtkWidget* expanded,
|
| - GtkWidget* child,
|
| - GtkRequisition* requisition,
|
| - gpointer control_child_size) {
|
| - // If |control_child_size| is true, then we want |child_| to match the width
|
| - // of the |widget_|, but the height of |child_| should not change.
|
| - if (!GPOINTER_TO_INT(control_child_size)) {
|
| - requisition->width = -1;
|
| - }
|
| - requisition->height = -1;
|
| +void OnFixedSizeAllocate(GtkWidget* fixed,
|
| + GtkAllocation* allocation,
|
| + GtkWidget* child) {
|
| + // The size of the GtkFixed has changed. We want |child_| to match widths,
|
| + // but the height should not change.
|
| + gtk_widget_set_size_request(child, allocation->width, -1);
|
| }
|
|
|
| } // namespace
|
| @@ -35,17 +29,17 @@
|
| : child_(child),
|
| direction_(direction),
|
| delegate_(delegate) {
|
| - widget_.Own(gtk_expanded_container_new());
|
| - gtk_container_add(GTK_CONTAINER(widget_.get()), child);
|
| + widget_.Own(gtk_fixed_new());
|
| + gtk_fixed_put(GTK_FIXED(widget_.get()), child, 0, 0);
|
| gtk_widget_set_size_request(widget_.get(), -1, 0);
|
| + if (control_child_size) {
|
| + // If the child requests it, we will manually set the size request for
|
| + // |child_| every time the GtkFixed changes sizes. This is mainly useful
|
| + // for bars, where we want the child to expand to fill all available space.
|
| + g_signal_connect(widget_.get(), "size-allocate",
|
| + G_CALLBACK(OnFixedSizeAllocate), child_);
|
| + }
|
|
|
| - // If the child requests it, we will manually set the size request for
|
| - // |child_| every time the |widget_| changes sizes. This is mainly useful
|
| - // for bars, where we want the child to expand to fill all available space.
|
| - g_signal_connect(widget_.get(), "child-size-request",
|
| - G_CALLBACK(OnChildSizeRequest),
|
| - GINT_TO_POINTER(control_child_size));
|
| -
|
| // We connect to this signal to set an initial position for our child widget.
|
| // The reason we connect to this signal rather than setting the initial
|
| // position here is that the widget is currently unallocated and may not
|
| @@ -112,8 +106,8 @@
|
| int showing_height = static_cast<int>(req.height *
|
| animation_->GetCurrentValue());
|
| if (direction_ == DOWN) {
|
| - gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()),
|
| - child_, 0, showing_height - req.height);
|
| + gtk_fixed_move(GTK_FIXED(widget_.get()), child_, 0,
|
| + showing_height - req.height);
|
| child_needs_move_ = false;
|
| }
|
| gtk_widget_set_size_request(widget_.get(), -1, showing_height);
|
| @@ -132,8 +126,7 @@
|
| GtkAllocation* allocation,
|
| SlideAnimatorGtk* slider) {
|
| if (slider->child_needs_move_) {
|
| - gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(slider->widget()),
|
| - child, 0, -allocation->height);
|
| + gtk_fixed_move(GTK_FIXED(slider->widget()), child, 0, -allocation->height);
|
| slider->child_needs_move_ = false;
|
| }
|
| }
|
|
|