From ada47ecf6b99a36a4c04ac8525708766b0482801 Mon Sep 17 00:00:00 2001 From: "oshima@google.com" Date: Sat, 16 Jul 2011 01:42:48 +0000 Subject: Move debug paint flag to Widget so native widget can use the same flag. BUG=none TEST=none Review URL: http://codereview.chromium.org/7398014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92779 0039d316-1c4b-4281-b951-d872f2087c98 --- views/widget/native_widget_gtk.cc | 7 ++----- views/widget/native_widget_gtk.h | 3 --- views/widget/widget.cc | 13 +++++++++++++ views/widget/widget.h | 4 ++++ 4 files changed, 19 insertions(+), 8 deletions(-) (limited to 'views') diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc index 38d6a6d..50e9b97 100644 --- a/views/widget/native_widget_gtk.cc +++ b/views/widget/native_widget_gtk.cc @@ -610,11 +610,6 @@ bool NativeWidgetGtk::SuppressFreezeUpdates() { } // static -void NativeWidgetGtk::EnableDebugPaint() { - gdk_window_set_debug_updates(true); -} - -// static void NativeWidgetGtk::UpdateFreezeUpdatesProperty(GtkWindow* window, bool enable) { if (!GTK_WIDGET_REALIZED(GTK_WIDGET(window))) @@ -1377,6 +1372,8 @@ void NativeWidgetGtk::OnSizeAllocate(GtkWidget* widget, } gboolean NativeWidgetGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { + gdk_window_set_debug_updates(Widget::IsDebugPaintEnabled()); + if (transparent_ && child_) { // Clear the background before drawing any view and native components. DrawTransparentBackground(widget, event); diff --git a/views/widget/native_widget_gtk.h b/views/widget/native_widget_gtk.h index bca6c24..4555691 100644 --- a/views/widget/native_widget_gtk.h +++ b/views/widget/native_widget_gtk.h @@ -117,9 +117,6 @@ class NativeWidgetGtk : public internal::NativeWidgetPrivate, // FREEZE_UPDATES property is removed, or false otherwise. bool SuppressFreezeUpdates(); - // Enables debug painting. See |debug_paint_enabled_| for details. - static void EnableDebugPaint(); - // Sets and deletes FREEZE_UPDATES property on given |window|. // It adds the property when |enable| is true and remove if false. // Calling this method will realize the window if it's not realized yet. diff --git a/views/widget/widget.cc b/views/widget/widget.cc index 9234483..628efb4 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -25,6 +25,9 @@ namespace views { namespace { // Set to true if a pure Views implementation is preferred bool use_pure_views = false; + +// True to enable debug paint that indicates where to be painted. +bool debug_paint = false; } // This class is used to keep track of the event a Widget is processing, and @@ -258,6 +261,16 @@ gfx::Size Widget::GetLocalizedContentsSize(int col_resource_id, GetLocalizedContentsHeight(row_resource_id)); } +// static +void Widget::SetDebugPaintEnabled(bool enabled) { + debug_paint = enabled; +} + +// static +bool Widget::IsDebugPaintEnabled() { + return debug_paint; +} + void Widget::Init(const InitParams& params) { widget_delegate_ = params.delegate ? params.delegate : new DefaultWidgetDelegate(this); diff --git a/views/widget/widget.h b/views/widget/widget.h index aea6ff9..1f8f72b 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -220,6 +220,10 @@ class Widget : public internal::NativeWidgetDelegate, static gfx::Size GetLocalizedContentsSize(int col_resource_id, int row_resource_id); + // Enable/Disable debug paint. + static void SetDebugPaintEnabled(bool enabled); + static bool IsDebugPaintEnabled(); + void Init(const InitParams& params); // Returns the gfx::NativeView associated with this Widget. -- cgit v1.1