summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 15:37:03 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 15:37:03 +0000
commitd40ee01bc088303b3f8345c56596b6df09964251 (patch)
tree327491f7f5494533a4a76e2b78ef91787d0bbbca
parentd2226929eff7217884f48cede43cc705014d51d3 (diff)
downloadchromium_src-d40ee01bc088303b3f8345c56596b6df09964251.zip
chromium_src-d40ee01bc088303b3f8345c56596b6df09964251.tar.gz
chromium_src-d40ee01bc088303b3f8345c56596b6df09964251.tar.bz2
Fixes bug in views on gtk where we wouldn't necessarily paint
correctly on an expose. This happened if between the time we told Gtk we needed to paint and the time we got the expose event more paints were scheduled. In this case, because we were double buffered, GTK would clip to the original region we scheduled the paint for. The fix is to turn off double buffering as we're double buffering ourself. BUG=none TEST=none Review URL: http://codereview.chromium.org/198036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25621 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/widget/widget_gtk.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index e96543e..4f24498 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -478,8 +478,16 @@ void WidgetGtk::DidProcessEvent(GdkEvent* event) {
// TODO(beng): organize into sections:
void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) {
+ // We turn off double buffering for two reasons:
+ // 1. We draw to a canvas then composite to the screen, which means we're
+ // doing our own double buffering already.
+ // 2. GTKs double buffering clips to the dirty region. RootView occasionally
+ // needs to expand the paint region (see RootView::OnPaint). This means
+ // that if we use GTK's double buffering and we tried to expand the dirty
+ // region, it wouldn't get painted.
if (type_ == TYPE_CHILD) {
window_contents_ = widget_ = gtk_fixed_new();
+ GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED);
gtk_fixed_set_has_window(GTK_FIXED(widget_), true);
if (!parent && !null_parent_) {
GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP);
@@ -492,6 +500,7 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) {
} else {
widget_ = gtk_window_new(
type_ == TYPE_WINDOW ? GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP);
+ GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED);
if (!bounds.size().IsEmpty()) {
// When we realize the window, the window manager is given a size. If we
@@ -507,6 +516,7 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) {
SetViewForNative(widget_, this);
window_contents_ = gtk_fixed_new();
+ GTK_WIDGET_UNSET_FLAGS(window_contents_, GTK_DOUBLE_BUFFERED);
gtk_fixed_set_has_window(GTK_FIXED(window_contents_), true);
gtk_container_add(GTK_CONTAINER(widget_), window_contents_);
gtk_widget_show(window_contents_);
@@ -1036,12 +1046,11 @@ void WidgetGtk::ConfigureWidgetForTransparentBackground() {
return;
}
// To make the background transparent we need to install the RGBA colormap
- // on both the window and fixed. In addition we need to turn off double
- // buffering and make sure no decorations are drawn. The last bit is to make
- // sure the widget doesn't attempt to draw a pixmap in it's background.
+ // on both the window and fixed. In addition we need to make sure no
+ // decorations are drawn. The last bit is to make sure the widget doesn't
+ // attempt to draw a pixmap in it's background.
gtk_widget_set_colormap(widget_, rgba_colormap);
gtk_widget_set_app_paintable(widget_, true);
- GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED);
gtk_widget_realize(widget_);
gdk_window_set_decorations(widget_->window,
static_cast<GdkWMDecoration>(0));
@@ -1050,7 +1059,6 @@ void WidgetGtk::ConfigureWidgetForTransparentBackground() {
gtk_widget_set_colormap(window_contents_, rgba_colormap);
gtk_widget_set_app_paintable(window_contents_, true);
- GTK_WIDGET_UNSET_FLAGS(window_contents_, GTK_DOUBLE_BUFFERED);
gtk_widget_realize(window_contents_);
// Widget must be realized before setting pixmap.
gdk_window_set_back_pixmap(window_contents_->window, NULL, FALSE);