diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-16 01:42:48 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-16 01:42:48 +0000 |
commit | ada47ecf6b99a36a4c04ac8525708766b0482801 (patch) | |
tree | 0629d5ebd35e694c5a0b2d261c0829bce750cc20 /views | |
parent | 51124558810b72b34d23f643a327ea5b2a90ec9f (diff) | |
download | chromium_src-ada47ecf6b99a36a4c04ac8525708766b0482801.zip chromium_src-ada47ecf6b99a36a4c04ac8525708766b0482801.tar.gz chromium_src-ada47ecf6b99a36a4c04ac8525708766b0482801.tar.bz2 |
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
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/native_widget_gtk.cc | 7 | ||||
-rw-r--r-- | views/widget/native_widget_gtk.h | 3 | ||||
-rw-r--r-- | views/widget/widget.cc | 13 | ||||
-rw-r--r-- | views/widget/widget.h | 4 |
4 files changed, 19 insertions, 8 deletions
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. |