summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc4
-rw-r--r--views/widget/native_widget_gtk.cc7
-rw-r--r--views/widget/native_widget_gtk.h3
-rw-r--r--views/widget/widget.cc13
-rw-r--r--views/widget/widget.h4
5 files changed, 20 insertions, 11 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 78d5ab4..4615c72 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -1052,11 +1052,9 @@ void InitializeToolkit(const MainFunctionParams& parameters) {
if (!views::ViewsDelegate::views_delegate)
views::ViewsDelegate::views_delegate = new ChromeViewsDelegate;
-#if defined(TOOLKIT_USES_GTK)
// TODO(beng): Move to WidgetImpl and implement on Windows too!
if (parameters.command_line_.HasSwitch(switches::kDebugViewsPaint))
- views::NativeWidgetGtk::EnableDebugPaint();
-#endif
+ views::Widget::SetDebugPaintEnabled(true);
#endif
#if defined(OS_WIN)
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.