summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 20:16:01 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 20:16:01 +0000
commit1e376f52306f59f963d6f3e15a83d8ad3808c8b9 (patch)
tree559e165989ed1bdcaf4e3e43d735683d339dfc7f /views
parent1b196a327885f7a5e818f5cc40d660f645952dc8 (diff)
downloadchromium_src-1e376f52306f59f963d6f3e15a83d8ad3808c8b9.zip
chromium_src-1e376f52306f59f963d6f3e15a83d8ad3808c8b9.tar.gz
chromium_src-1e376f52306f59f963d6f3e15a83d8ad3808c8b9.tar.bz2
Fixes painting problems with views on Gtk. In particular during a
paint we would expand the region Gtk wants to paint to include the region views wants to paint. This is problematic if the views region isn't contained in the gtk region. In such a case any gtk widgets without windows aren't painted correctly. The correct thing to do is schedule the paint through gtk so that the child widgets are painted. Additionally I'm making WidgetGtk::PaintNow actually paint now, which helps avoid this situation. BUG=23430 TEST=see bug Review URL: http://codereview.chromium.org/246047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/root_view_gtk.cc31
-rw-r--r--views/widget/widget_gtk.cc2
2 files changed, 21 insertions, 12 deletions
diff --git a/views/widget/root_view_gtk.cc b/views/widget/root_view_gtk.cc
index 290203f..75f444e 100644
--- a/views/widget/root_view_gtk.cc
+++ b/views/widget/root_view_gtk.cc
@@ -13,27 +13,34 @@
namespace views {
void RootView::OnPaint(GdkEventExpose* event) {
- gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize();
- if (!original_dirty_region.IsEmpty()) {
- // Between the the time the paint was scheduled and the time we end
- // up painting more SchedulePaints may have been invoked. Expand the
- // region Gdk wants us to paint to include the region we want to paint
- // to make sure everything is painted. Otherwise we may not paint
- // everything we need to.
- gfx::Rect complete_area =
- original_dirty_region.Union(gfx::Rect(event->area));
- event->area = complete_area.ToGdkRectangle();
- }
-
+ gfx::Rect scheduled_dirty_rect = GetScheduledPaintRectConstrainedToSize();
+ gfx::Rect expose_rect = gfx::Rect(event->area);
gfx::CanvasPaint canvas(event);
+ bool invoked_process_paint = false;
if (!canvas.is_empty()) {
canvas.set_composite_alpha(
static_cast<WidgetGtk*>(GetWidget())->is_transparent());
SchedulePaint(gfx::Rect(canvas.rectangle()), false);
if (NeedsPainting(false)) {
ProcessPaint(&canvas);
+ invoked_process_paint = true;
}
}
+
+ if (invoked_process_paint && !scheduled_dirty_rect.IsEmpty() &&
+ !expose_rect.Contains(scheduled_dirty_rect)) {
+ // The region Views needs to paint (scheduled_dirty_rect) isn't contained
+ // within the region GTK wants us to paint. ProccessPaint clears out the
+ // dirty region, so that at this point views thinks everything has painted
+ // correctly, but we haven't. Invoke schedule paint again to make sure we
+ // paint everything we need to.
+ //
+ // NOTE: We don't expand the region to paint to include
+ // scheduled_dirty_rect as that results in us drawing on top of any GTK
+ // widgets that don't have a window. We have to schedule the paint through
+ // GTK so that such widgets are painted.
+ SchedulePaint(scheduled_dirty_rect, false);
+ }
}
void RootView::StartDragForViewFromMouseEvent(
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 81c214d..1453250 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -393,6 +393,8 @@ void WidgetGtk::PaintNow(const gfx::Rect& update_rect) {
if (widget_) {
gtk_widget_queue_draw_area(widget_, update_rect.x(), update_rect.y(),
update_rect.width(), update_rect.height());
+ // Force the paint to occur now.
+ gdk_window_process_updates(widget_->window, true);
}
}