diff options
Diffstat (limited to 'views/widget/root_view_gtk.cc')
-rw-r--r-- | views/widget/root_view_gtk.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/views/widget/root_view_gtk.cc b/views/widget/root_view_gtk.cc index 75f444e..e284313 100644 --- a/views/widget/root_view_gtk.cc +++ b/views/widget/root_view_gtk.cc @@ -13,13 +13,17 @@ namespace views { void RootView::OnPaint(GdkEventExpose* event) { + WidgetGtk* widget = static_cast<WidgetGtk*>(GetWidget()); + if (!widget) { + NOTREACHED(); + return; + } 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()); + canvas.set_composite_alpha(widget->is_transparent()); SchedulePaint(gfx::Rect(canvas.rectangle()), false); if (NeedsPainting(false)) { ProcessPaint(&canvas); @@ -28,12 +32,15 @@ void RootView::OnPaint(GdkEventExpose* event) { } 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. + !expose_rect.Contains(scheduled_dirty_rect) && widget && + !widget->in_paint_now()) { + // We're painting as the result of Gtk wanting us to paint (not from views) + // and there was a region scheduled by views to be painted that is not + // contained in the region gtk wants us to paint. As a result of the + // ProcessPaint call above views no longer thinks it needs to be painted. + // We have to invoke SchedulePaint here to be sure we end up painting the + // region views wants to paint, otherwise we'll drop the views paint region + // on the floor. // // 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 |