Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: chrome/browser/renderer_host/gtk_key_bindings_handler.cc

Issue 402083: Linux: Fix regression issue 27964: ctrl+tab loses focus from the text box.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/renderer_host/gtk_key_bindings_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/gtk_key_bindings_handler.h" 5 #include "chrome/browser/renderer_host/gtk_key_bindings_handler.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // We don't need to show the |handler| object on screen, so set its size to 53 // We don't need to show the |handler| object on screen, so set its size to
54 // zero. 54 // zero.
55 gtk_widget_set_size_request(GTK_WIDGET(handler), 0, 0); 55 gtk_widget_set_size_request(GTK_WIDGET(handler), 0, 0);
56 56
57 // Prevents it from handling any events by itself. 57 // Prevents it from handling any events by itself.
58 gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE); 58 gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE);
59 gtk_widget_set_events(GTK_WIDGET(handler), 0); 59 gtk_widget_set_events(GTK_WIDGET(handler), 0);
60 GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(handler), GTK_CAN_FOCUS); 60 GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(handler), GTK_CAN_FOCUS);
61 61
62 #if !GTK_CHECK_VERSION(2, 14, 0) 62 #if !GTK_CHECK_VERSION(2, 14, 0)
63 // "move-viewport", "select-all" and "toggle-cursor-visible" have no 63 // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible"
64 // corresponding virtual methods. Prior to glib 2.18 (gtk 2.14), there is no 64 // have no corresponding virtual methods. Prior to glib 2.18 (gtk 2.14),
65 // way to override the default class handler of a signal. So we need hook 65 // there is no way to override the default class handler of a signal.
66 // these signal explicitly. 66 // So we need hook these signal explicitly.
67 g_signal_connect(handler, "move-focus", G_CALLBACK(MoveFocus), NULL);
67 g_signal_connect(handler, "move-viewport", G_CALLBACK(MoveViewport), NULL); 68 g_signal_connect(handler, "move-viewport", G_CALLBACK(MoveViewport), NULL);
68 g_signal_connect(handler, "select-all", G_CALLBACK(SelectAll), NULL); 69 g_signal_connect(handler, "select-all", G_CALLBACK(SelectAll), NULL);
69 g_signal_connect(handler, "toggle-cursor-visible", 70 g_signal_connect(handler, "toggle-cursor-visible",
70 G_CALLBACK(ToggleCursorVisible), NULL); 71 G_CALLBACK(ToggleCursorVisible), NULL);
71 #endif 72 #endif
72 return GTK_WIDGET(handler); 73 return GTK_WIDGET(handler);
73 } 74 }
74 75
75 void GtkKeyBindingsHandler::EditCommandMatched( 76 void GtkKeyBindingsHandler::EditCommandMatched(
76 const std::string& name, const std::string& value) { 77 const std::string& name, const std::string& value) {
77 edit_commands_.push_back(EditCommand(name, value)); 78 edit_commands_.push_back(EditCommand(name, value));
78 } 79 }
79 80
80 void GtkKeyBindingsHandler::HandlerInit(Handler *self) { 81 void GtkKeyBindingsHandler::HandlerInit(Handler *self) {
81 self->owner = NULL; 82 self->owner = NULL;
82 } 83 }
83 84
84 void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass *klass) { 85 void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass *klass) {
85 GtkTextViewClass* text_view_class = GTK_TEXT_VIEW_CLASS(klass); 86 GtkTextViewClass* text_view_class = GTK_TEXT_VIEW_CLASS(klass);
87 GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
86 88
87 // Overrides all virtual methods related to editor key bindings. 89 // Overrides all virtual methods related to editor key bindings.
88 text_view_class->backspace = BackSpace; 90 text_view_class->backspace = BackSpace;
89 text_view_class->copy_clipboard = CopyClipboard; 91 text_view_class->copy_clipboard = CopyClipboard;
90 text_view_class->cut_clipboard = CutClipboard; 92 text_view_class->cut_clipboard = CutClipboard;
91 text_view_class->delete_from_cursor = DeleteFromCursor; 93 text_view_class->delete_from_cursor = DeleteFromCursor;
92 text_view_class->insert_at_cursor = InsertAtCursor; 94 text_view_class->insert_at_cursor = InsertAtCursor;
93 text_view_class->move_cursor = MoveCursor; 95 text_view_class->move_cursor = MoveCursor;
94 text_view_class->paste_clipboard = PasteClipboard; 96 text_view_class->paste_clipboard = PasteClipboard;
95 text_view_class->set_anchor = SetAnchor; 97 text_view_class->set_anchor = SetAnchor;
96 text_view_class->toggle_overwrite = ToggleOverwrite; 98 text_view_class->toggle_overwrite = ToggleOverwrite;
99 widget_class->show_help = ShowHelp;
97 100
98 #if GTK_CHECK_VERSION(2, 14, 0) 101 #if GTK_CHECK_VERSION(2, 14, 0)
99 // "move-viewport", "select-all" and "toggle-cursor-visible" have no 102 // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible"
100 // corresponding virtual methods. Since glib 2.18 (gtk 2.14), 103 // have no corresponding virtual methods. Since glib 2.18 (gtk 2.14),
101 // g_signal_override_class_handler() is introduced to override a signal 104 // g_signal_override_class_handler() is introduced to override a signal
102 // handler. 105 // handler.
106 g_signal_override_class_handler("move-focus",
107 G_TYPE_FROM_CLASS(klass),
108 G_CALLBACK(MoveFocus));
109
103 g_signal_override_class_handler("move-viewport", 110 g_signal_override_class_handler("move-viewport",
104 G_TYPE_FROM_CLASS(klass), 111 G_TYPE_FROM_CLASS(klass),
105 G_CALLBACK(MoveViewport)); 112 G_CALLBACK(MoveViewport));
106 113
107 g_signal_override_class_handler("select-all", 114 g_signal_override_class_handler("select-all",
108 G_TYPE_FROM_CLASS(klass), 115 G_TYPE_FROM_CLASS(klass),
109 G_CALLBACK(SelectAll)); 116 G_CALLBACK(SelectAll));
110 117
111 g_signal_override_class_handler("toggle-cursor-visible", 118 g_signal_override_class_handler("toggle-cursor-visible",
112 G_TYPE_FROM_CLASS(klass), 119 G_TYPE_FROM_CLASS(klass),
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Before gtk 2.14.0, there is no way to override a non-virtual default signal 302 // Before gtk 2.14.0, there is no way to override a non-virtual default signal
296 // handler, so we need stop the signal emission explicitly to prevent the 303 // handler, so we need stop the signal emission explicitly to prevent the
297 // default handler from being executed. 304 // default handler from being executed.
298 g_signal_stop_emission_by_name(text_view, "toggle-cursor-visible"); 305 g_signal_stop_emission_by_name(text_view, "toggle-cursor-visible");
299 #endif 306 #endif
300 } 307 }
301 308
302 void GtkKeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) { 309 void GtkKeyBindingsHandler::ToggleOverwrite(GtkTextView* text_view) {
303 // Not supported by webkit. 310 // Not supported by webkit.
304 } 311 }
312
313 gboolean GtkKeyBindingsHandler::ShowHelp(GtkWidget* widget,
314 GtkWidgetHelpType arg1) {
315 // Just for disabling the default handler.
316 return FALSE;
317 }
318
319 void GtkKeyBindingsHandler::MoveFocus(GtkWidget* widget,
320 GtkDirectionType arg1) {
321 // Just for disabling the default handler.
322 #if !GTK_CHECK_VERSION(2, 14, 0)
323 // Before gtk 2.14.0, there is no way to override a non-virtual default signal
324 // handler, so we need stop the signal emission explicitly to prevent the
325 // default handler from being executed.
326 g_signal_stop_emission_by_name(widget, "move-focus");
327 #endif
328 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/gtk_key_bindings_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698