summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-18 18:02:27 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-18 18:02:27 +0000
commitc17a3ac5ea1f8d44ef6a7533c6216ab1ee6b741a (patch)
tree98a683aec174060d9178c5dcb608553c9c2dc3cd /views
parent64b2cb040ca23e74a40b4d10e430169c5c5201a6 (diff)
downloadchromium_src-c17a3ac5ea1f8d44ef6a7533c6216ab1ee6b741a.zip
chromium_src-c17a3ac5ea1f8d44ef6a7533c6216ab1ee6b741a.tar.gz
chromium_src-c17a3ac5ea1f8d44ef6a7533c6216ab1ee6b741a.tar.bz2
WidgetGtk: connect to "map" signal instead of "show".
If a GtkWidget is gtk_widget_show'n before its parent widget, then the child widget will not have a GdkWindow when "show" triggers. "map" is a more appropriate signal to do something on the GdkWindow after it's created and drawable. BUG=76573 TEST=CollectedCookiesTest.* Review URL: http://codereview.chromium.org/6688028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/widget_gtk.cc7
-rw-r--r--views/widget/widget_gtk.h3
2 files changed, 8 insertions, 2 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 8b74554..1c3d541 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -549,6 +549,8 @@ void WidgetGtk::Init(GtkWidget* parent,
G_CALLBACK(&OnDestroyThunk), this);
g_signal_connect(widget_, "show",
G_CALLBACK(&OnShowThunk), this);
+ g_signal_connect(widget_, "map",
+ G_CALLBACK(&OnMapThunk), this);
g_signal_connect(widget_, "hide",
G_CALLBACK(&OnHideThunk), this);
@@ -1247,8 +1249,11 @@ void WidgetGtk::OnDestroy(GtkWidget* object) {
}
void WidgetGtk::OnShow(GtkWidget* widget) {
+}
+
+void WidgetGtk::OnMap(GtkWidget* widget) {
// Force an expose event to trigger OnPaint. This is necessary because earlier
- // SchedulePaintInRect calls for the widget may have happened before the
+ // SchedulePaintInRect calls for the widget will have happened before the
// widget was drawable. This means that gtk_widget_queue_draw_area wasn't
// called, and so the widget will not get any expose events. Consequently, the
// widget won't paint itself until something else triggers a paint call.
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h
index 4df911c..39f6de5 100644
--- a/views/widget/widget_gtk.h
+++ b/views/widget/widget_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -262,6 +262,7 @@ class WidgetGtk : public Widget,
CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnGrabNotify, gboolean);
CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnDestroy);
CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnShow);
+ CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnMap);
CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnHide);
void set_mouse_down(bool mouse_down) { is_mouse_down_ = mouse_down; }