diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 06:45:25 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 06:45:25 +0000 |
commit | 8d6fcc39959c711b3921de41fec30c8cfdd071a3 (patch) | |
tree | 1f0ed57a77714f58e9f626b650d1b8aaef546289 /views/widget | |
parent | d5e02bfdcf6881d81b49c8c49d25e0149ebe48a3 (diff) | |
download | chromium_src-8d6fcc39959c711b3921de41fec30c8cfdd071a3.zip chromium_src-8d6fcc39959c711b3921de41fec30c8cfdd071a3.tar.gz chromium_src-8d6fcc39959c711b3921de41fec30c8cfdd071a3.tar.bz2 |
Draw composited widget's content only after something is drawn.
This was causing ugly flicker when screen locker is shown.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2717002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/widget_gtk.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 5d946f5..5f0f6f8 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -62,15 +62,13 @@ class CompositePainter { } } - // Enable the composition. + // Set the composition flag. static void SetComposited(GtkWidget* widget) { - DCHECK(GTK_WIDGET_REALIZED(widget)); - gdk_window_set_composited(widget->window, true); g_object_set_data(G_OBJECT(widget), kCompositeEnabledKey, const_cast<char*>("")); } - // Returns true if the |widget| is composited. + // Returns true if the |widget| is composited and ready to be drawn. static bool IsComposited(GtkWidget* widget) { return g_object_get_data(G_OBJECT(widget), kCompositeEnabledKey) != NULL; } @@ -901,6 +899,11 @@ gboolean WidgetGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { if (transparent_) { // Clear the background before drawing any view and native components. DrawTransparentBackground(widget, event); + if (type_ == TYPE_CHILD && !CompositePainter::IsComposited(widget_)) { + // Let the parent draw the content only after something is drawn on + // the widget. + CompositePainter::SetComposited(widget_); + } } root_view_->OnPaint(event); return false; // False indicates other widgets should get the event as well. @@ -1308,7 +1311,8 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) { // The widget has to be realized to set composited flag. // I tried "realize" signal to set this flag, but it did not work // when the top level is popup. - CompositePainter::SetComposited(widget_); + DCHECK(GTK_WIDGET_REALIZED(widget_)); + gdk_window_set_composited(widget_->window, true); } } else { widget_ = gtk_window_new( |