diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 16:12:06 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 16:12:06 +0000 |
commit | baac49a8766f3b5030e5d9889abcef795cb1091b (patch) | |
tree | e851ed9893ef803845604b3f22b0e1a76cbda700 /chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | |
parent | 486b7f1e4a940212f497e42b67d8e8c9d52664a2 (diff) | |
download | chromium_src-baac49a8766f3b5030e5d9889abcef795cb1091b.zip chromium_src-baac49a8766f3b5030e5d9889abcef795cb1091b.tar.gz chromium_src-baac49a8766f3b5030e5d9889abcef795cb1091b.tar.bz2 |
Improve key event handling of AutocompleteEditViewGtk.
This CL improves key event handling of AutocompleteEditViewGtk class, following changes have been made:
1. Avoid accessing private data member of GtkTextView object, including im_context, need_im_reset etc.
2. Always send key events to the default handler of GtkTextView before handling them by ourselves, to make sure the behavior of IME and GtkTextView are always correct. This fixes the issue of moving focus from omnibox to webpage by pressing Tab key when using XIM im module.
3. Intercept "insert-text" signal of GtkTextBuffer object to prevent any unwanted characters from being inserted into omnibox.
4. Intercept "backspace" signal of GtkTextView object to fix issue 19068: [Linux] Search keywords: Backspace should exit out of search mode
BUG=18393: AutocompleteEditViewGtk should not access private members of GtkTextView
BUG=19068: [Linux] Search keywords: Backspace should exit out of search mode
TEST=Starts a XIM input method, such as scim then open chrome with GTK_IM_MODULE=xim. Opens a webpage and press tab and shift-tab in omnibox to see if focus can be moved to/from webpage correctly.
TEST=Copy & paste some text with new line characters to omnibox to see if new line characters are filtered.
TEST=Turn on keyword search mode, press backspace to see if it can exit keyword search mode.
TEST= Turn on keyword search mode, input some text then press backspace to delete a character, to see if it still in keyword search mode. Then move the cursor to the beginning of the text and press backspace, to see if it exits keyword search mode correctly.
Review URL: http://codereview.chromium.org/164142
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.h')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index 667c756..2de9f37 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -7,6 +7,8 @@ #include <gtk/gtk.h> +#include <string> + #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/string_util.h" @@ -251,6 +253,24 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, GtkSelectionData* selection_data, guint target_type, guint time); + static void HandleInsertTextThunk(GtkTextBuffer* buffer, + GtkTextIter* location, + const gchar* text, + gint len, + gpointer self) { + reinterpret_cast<AutocompleteEditViewGtk*>(self)-> + HandleInsertText(buffer, location, text, len); + } + void HandleInsertText(GtkTextBuffer* buffer, + GtkTextIter* location, + const gchar* text, + gint len); + + static void HandleBackSpaceThunk(GtkTextView* text_view, gpointer self) { + reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleBackSpace(); + } + void HandleBackSpace(); + // Actual implementation of SelectAll(), but also provides control over // whether the PRIMARY selection is set to the selected text (in SelectAll(), // it isn't, but we want set the selection when the user clicks in the entry). |