summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 21:29:06 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 21:29:06 +0000
commit3c51d389bac87e6dc88881095dc60faf9e763cc0 (patch)
treeb9c9c5f9c7eb90060e2a8458cb30b06c3130e655 /views
parent3b93668a62b78975639f9248fd06116d02b34616 (diff)
downloadchromium_src-3c51d389bac87e6dc88881095dc60faf9e763cc0.zip
chromium_src-3c51d389bac87e6dc88881095dc60faf9e763cc0.tar.gz
chromium_src-3c51d389bac87e6dc88881095dc60faf9e763cc0.tar.bz2
Unblock focus signal handlers only when they're blocked.
Unblocking fails when handlers are not blocked. Minor fix. use correct data type for signal handler id. BUG=none TEST=none Review URL: http://codereview.chromium.org/844003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/native/native_view_host_gtk.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc
index 9b390e9..8708238 100644
--- a/views/controls/native/native_view_host_gtk.cc
+++ b/views/controls/native/native_view_host_gtk.cc
@@ -35,10 +35,10 @@ void InitSignalIds() {
// Blocks a |signal_id| on the given |widget| if any.
void BlockSignal(GtkWidget* widget, guint signal_id) {
- int handler_id = g_signal_handler_find(G_OBJECT(widget),
- G_SIGNAL_MATCH_ID,
- signal_id,
- 0, NULL, NULL, NULL);
+ gulong handler_id = g_signal_handler_find(G_OBJECT(widget),
+ G_SIGNAL_MATCH_ID,
+ signal_id,
+ 0, NULL, NULL, NULL);
if (handler_id) {
g_signal_handler_block(G_OBJECT(widget), handler_id);
}
@@ -46,10 +46,10 @@ void BlockSignal(GtkWidget* widget, guint signal_id) {
// Unblocks a |signal_id| on the given |widget| if any.
void UnblockSignal(GtkWidget* widget, guint signal_id) {
- int handler_id = g_signal_handler_find(G_OBJECT(widget),
- G_SIGNAL_MATCH_ID,
- signal_id,
- 0, NULL, NULL, NULL);
+ gulong handler_id = g_signal_handler_find(G_OBJECT(widget),
+ G_SIGNAL_MATCH_ID,
+ signal_id,
+ 0, NULL, NULL, NULL);
if (handler_id) {
g_signal_handler_unblock(G_OBJECT(widget), handler_id);
}
@@ -182,7 +182,6 @@ void NativeViewHostGtk::AddedToWidget() {
void NativeViewHostGtk::RemovedFromWidget() {
if (!host_->native_view())
return;
-
DestroyFixed();
}
@@ -253,9 +252,13 @@ void NativeViewHostGtk::SetFocus() {
void NativeViewHostGtk::CreateFixed(bool needs_window) {
GtkWidget* focused_widget = GetFocusedDescendant();
+ bool focus_event_blocked = false;
// We move focus around and do not want focus events to be emitted
// during this process.
- BlockFocusSignals(GetHostWidget()->GetNativeView(), NULL);
+ if (fixed_) {
+ BlockFocusSignals(GetHostWidget()->GetNativeView(), NULL);
+ focus_event_blocked = true;
+ }
if (focused_widget) {
// A descendant of our fixed has focus. When we destroy the fixed focus is
@@ -282,7 +285,11 @@ void NativeViewHostGtk::CreateFixed(bool needs_window) {
if (widget_gtk && host_->native_view() && focused_widget) {
gtk_widget_grab_focus(focused_widget);
}
- UnblockFocusSignals(GetHostWidget()->GetNativeView(), NULL);
+ if (focus_event_blocked) {
+ // Unblocking a signal handler that is not blocked fails.
+ // Unblock only when it's unblocked.
+ UnblockFocusSignals(GetHostWidget()->GetNativeView(), NULL);
+ }
}
void NativeViewHostGtk::DestroyFixed() {