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

Unified Diff: views/widget/widget_gtk.cc

Issue 2768006: Test + Fix for GTK window resizing when using toolkit views. (Closed)
Patch Set: Return a gfx::Size instead. Created 10 years, 4 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
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 1f7afb2eecd571227b80de7007eb57b93d94925f..f74eef1357deef9be036c4b0e35b225f77ca2480 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -331,7 +331,7 @@ void WidgetGtk::RemoveChild(GtkWidget* child) {
// closed.
if (GTK_IS_CONTAINER(window_contents_)) {
gtk_container_remove(GTK_CONTAINER(window_contents_), child);
- gtk_views_fixed_set_use_allocated_size(child, false);
+ gtk_views_fixed_set_widget_size(child, 0, 0);
}
}
@@ -340,9 +340,7 @@ void WidgetGtk::ReparentChild(GtkWidget* child) {
}
void WidgetGtk::PositionChild(GtkWidget* child, int x, int y, int w, int h) {
- GtkAllocation alloc = { x, y, w, h };
- gtk_widget_size_allocate(child, &alloc);
- gtk_views_fixed_set_use_allocated_size(child, true);
+ gtk_views_fixed_set_widget_size(child, w, h);
gtk_fixed_move(GTK_FIXED(window_contents_), child, x, y);
}
@@ -429,6 +427,18 @@ RootView* WidgetGtk::GetRootViewForWidget(GtkWidget* widget) {
return static_cast<RootView*>(user_data);
}
+void WidgetGtk::GetRequestedSize(gfx::Size* out) const {
+ int width, height;
+ if (GTK_IS_VIEWS_FIXED(widget_) &&
+ gtk_views_fixed_get_widget_size(GetNativeView(), &width, &height)) {
+ out->SetSize(width, height);
+ } else {
+ GtkRequisition requisition;
+ gtk_widget_get_child_requisition(GetNativeView(), &requisition);
+ out->SetSize(requisition.width, requisition.height);
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// WidgetGtk, ActiveWindowWatcherX::Observer implementation:
« 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