| Index: chrome/browser/renderer_host/gtk_key_bindings_handler.cc
|
| ===================================================================
|
| --- chrome/browser/renderer_host/gtk_key_bindings_handler.cc (revision 32495)
|
| +++ chrome/browser/renderer_host/gtk_key_bindings_handler.cc (working copy)
|
| @@ -60,10 +60,11 @@
|
| GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(handler), GTK_CAN_FOCUS);
|
|
|
| #if !GTK_CHECK_VERSION(2, 14, 0)
|
| - // "move-viewport", "select-all" and "toggle-cursor-visible" have no
|
| - // corresponding virtual methods. Prior to glib 2.18 (gtk 2.14), there is no
|
| - // way to override the default class handler of a signal. So we need hook
|
| - // these signal explicitly.
|
| + // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible"
|
| + // have no corresponding virtual methods. Prior to glib 2.18 (gtk 2.14),
|
| + // there is no way to override the default class handler of a signal.
|
| + // So we need hook these signal explicitly.
|
| + g_signal_connect(handler, "move-focus", G_CALLBACK(MoveFocus), NULL);
|
| g_signal_connect(handler, "move-viewport", G_CALLBACK(MoveViewport), NULL);
|
| g_signal_connect(handler, "select-all", G_CALLBACK(SelectAll), NULL);
|
| g_signal_connect(handler, "toggle-cursor-visible",
|
| @@ -83,6 +84,7 @@
|
|
|
| void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass *klass) {
|
| GtkTextViewClass* text_view_class = GTK_TEXT_VIEW_CLASS(klass);
|
| + GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
|
|
|
| // Overrides all virtual methods related to editor key bindings.
|
| text_view_class->backspace = BackSpace;
|
| @@ -94,12 +96,17 @@
|
| text_view_class->paste_clipboard = PasteClipboard;
|
| text_view_class->set_anchor = SetAnchor;
|
| text_view_class->toggle_overwrite = ToggleOverwrite;
|
| + widget_class->show_help = ShowHelp;
|
|
|
| #if GTK_CHECK_VERSION(2, 14, 0)
|
| - // "move-viewport", "select-all" and "toggle-cursor-visible" have no
|
| - // corresponding virtual methods. Since glib 2.18 (gtk 2.14),
|
| + // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible"
|
| + // have no corresponding virtual methods. Since glib 2.18 (gtk 2.14),
|
| // g_signal_override_class_handler() is introduced to override a signal
|
| // handler.
|
| + g_signal_override_class_handler("move-focus",
|
| + G_TYPE_FROM_CLASS(klass),
|
| + G_CALLBACK(MoveFocus));
|
| +
|
| g_signal_override_class_handler("move-viewport",
|
| G_TYPE_FROM_CLASS(klass),
|
| G_CALLBACK(MoveViewport));
|
| @@ -302,3 +309,20 @@
|
| void GtkKeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) {
|
| // Not supported by webkit.
|
| }
|
| +
|
| +gboolean GtkKeyBindingsHandler::ShowHelp(GtkWidget* widget,
|
| + GtkWidgetHelpType arg1) {
|
| + // Just for disabling the default handler.
|
| + return FALSE;
|
| +}
|
| +
|
| +void GtkKeyBindingsHandler::MoveFocus(GtkWidget* widget,
|
| + GtkDirectionType arg1) {
|
| + // Just for disabling the default handler.
|
| +#if !GTK_CHECK_VERSION(2, 14, 0)
|
| + // Before gtk 2.14.0, there is no way to override a non-virtual default signal
|
| + // handler, so we need stop the signal emission explicitly to prevent the
|
| + // default handler from being executed.
|
| + g_signal_stop_emission_by_name(widget, "move-focus");
|
| +#endif
|
| +}
|
|
|