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

Unified Diff: views/controls/native/native_view_host_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 | « chrome/chrome_tests.gypi ('k') | views/controls/tabbed_pane/tabbed_pane_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/native/native_view_host_gtk.cc
diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc
index 79a144dfcf039996cf814d7eb78da5b20675224b..2ba10b8d577fcaee0b9af0134abbd371e8438ccd 100644
--- a/views/controls/native/native_view_host_gtk.cc
+++ b/views/controls/native/native_view_host_gtk.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "views/controls/native/native_view_host.h"
#include "views/focus/focus_manager.h"
+#include "views/widget/gtk_views_fixed.h"
#include "views/widget/widget_gtk.h"
namespace views {
@@ -228,13 +229,16 @@ void NativeViewHostGtk::ShowWidget(int x, int y, int w, int h) {
fixed_h = std::min(installed_clip_bounds_.height(), h);
}
+ // Don't call gtk_widget_size_allocate now, as we're possibly in the
+ // middle of a re-size, and it kicks off another re-size, and you
+ // get flashing. Instead, we'll set the desired size as properties
+ // on the widget and queue the re-size.
+ gtk_views_fixed_set_widget_size(host_->native_view(), child_w, child_h);
+ gtk_fixed_move(GTK_FIXED(fixed_), host_->native_view(), child_x, child_y);
+
// Size and place the fixed_.
GetHostWidget()->PositionChild(fixed_, fixed_x, fixed_y, fixed_w, fixed_h);
- // Size and place the hosted NativeView.
- gtk_widget_set_size_request(host_->native_view(), child_w, child_h);
- gtk_fixed_move(GTK_FIXED(fixed_), host_->native_view(), child_x, child_y);
-
gtk_widget_show(fixed_);
gtk_widget_show(host_->native_view());
}
@@ -272,7 +276,7 @@ void NativeViewHostGtk::CreateFixed(bool needs_window) {
DestroyFixed();
- fixed_ = gtk_fixed_new();
+ fixed_ = gtk_views_fixed_new();
gtk_widget_set_name(fixed_, "views-native-view-host-fixed");
gtk_fixed_set_has_window(GTK_FIXED(fixed_), needs_window);
// Defeat refcounting. We need to own the fixed.
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | views/controls/tabbed_pane/tabbed_pane_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698