diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 01:59:49 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 01:59:49 +0000 |
commit | c4b867b51190ccec88a3a4b935c53795a71399a1 (patch) | |
tree | 02c06e14ee488f536188072a34f527a22a7287da | |
parent | 2d30a7a7a52b20401a386b5f76f09ebf9e9c72df (diff) | |
download | chromium_src-c4b867b51190ccec88a3a4b935c53795a71399a1.zip chromium_src-c4b867b51190ccec88a3a4b935c53795a71399a1.tar.gz chromium_src-c4b867b51190ccec88a3a4b935c53795a71399a1.tar.bz2 |
[Linux] FindBarGtk: Fix an issue caused by CL 560006.
This CL fixes an issue caused by CL 560006, which prevents the ctrl-Home/End key bindings from being sent to the renderer when the focus is inside the find bar.
BUG=none
TEST=Open a long web page and focus find bar then test if ctrl-Home/End still work.
Review URL: http://codereview.chromium.org/561017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38068 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.cc | 18 | ||||
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.h | 6 |
2 files changed, 22 insertions, 2 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index 114dcbb..8cf46c2 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -191,6 +191,7 @@ FindBarGtk::FindBarGtk(Browser* browser) gtk_widget_add_events(text_entry_, GDK_BUTTON_PRESS_MASK); g_signal_connect(text_entry_, "button-press-event", G_CALLBACK(OnButtonPress), this); + g_signal_connect(text_entry_, "move-cursor", G_CALLBACK(OnMoveCursor), this); g_signal_connect(container_, "expose-event", G_CALLBACK(OnExpose), this); } @@ -824,3 +825,18 @@ gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, // Continue propagating the event. return FALSE; } + +void FindBarGtk::OnMoveCursor(GtkEntry* entry, GtkMovementStep step, gint count, + gboolean selection, FindBarGtk* bar) { + static guint signal_id = g_signal_lookup("move-cursor", GTK_TYPE_ENTRY); + + GdkEvent* event = gtk_get_current_event(); + if (event) { + if ((event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) && + bar->MaybeForwardKeyEventToRenderer(&(event->key))) { + g_signal_stop_emission(entry, signal_id, 0); + } + + gdk_event_free(event); + } +} diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index d928c90..74df13b 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use +// Copyright (c) 2010 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. @@ -135,6 +135,10 @@ class FindBarGtk : public FindBar, static gboolean OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, FindBarGtk* find_bar); + // Forwards ctrl-Home/End key bindings to the renderer. + static void OnMoveCursor(GtkEntry* entry, GtkMovementStep step, gint count, + gboolean selection, FindBarGtk* bar); + Browser* browser_; BrowserWindowGtk* window_; |