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

Unified Diff: chrome/browser/gtk/slide_animator_gtk.cc

Issue 502073: Revert 34954 - Fix issue 11258: Linux: gracefully handle small browser window... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years 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 | « chrome/browser/gtk/infobar_gtk.cc ('k') | chrome/browser/gtk/tab_contents_container_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « chrome/browser/gtk/infobar_gtk.cc ('k') | chrome/browser/gtk/tab_contents_container_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698