OLD | NEW |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 handler->owner = this; | 48 handler->owner = this; |
49 | 49 |
50 // We don't need to show the |handler| object on screen, so set its size to | 50 // We don't need to show the |handler| object on screen, so set its size to |
51 // zero. | 51 // zero. |
52 gtk_widget_set_size_request(GTK_WIDGET(handler), 0, 0); | 52 gtk_widget_set_size_request(GTK_WIDGET(handler), 0, 0); |
53 | 53 |
54 // Prevents it from handling any events by itself. | 54 // Prevents it from handling any events by itself. |
55 gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE); | 55 gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE); |
56 gtk_widget_set_events(GTK_WIDGET(handler), 0); | 56 gtk_widget_set_events(GTK_WIDGET(handler), 0); |
57 GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(handler), GTK_CAN_FOCUS); | 57 gtk_widget_set_can_focus(GTK_WIDGET(handler), TRUE); |
58 | 58 |
59 #if !GTK_CHECK_VERSION(2, 14, 0) | 59 #if !GTK_CHECK_VERSION(2, 14, 0) |
60 // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible" | 60 // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible" |
61 // have no corresponding virtual methods. Prior to glib 2.18 (gtk 2.14), | 61 // have no corresponding virtual methods. Prior to glib 2.18 (gtk 2.14), |
62 // there is no way to override the default class handler of a signal. | 62 // there is no way to override the default class handler of a signal. |
63 // So we need hook these signal explicitly. | 63 // So we need hook these signal explicitly. |
64 g_signal_connect(handler, "move-focus", G_CALLBACK(MoveFocus), NULL); | 64 g_signal_connect(handler, "move-focus", G_CALLBACK(MoveFocus), NULL); |
65 g_signal_connect(handler, "move-viewport", G_CALLBACK(MoveViewport), NULL); | 65 g_signal_connect(handler, "move-viewport", G_CALLBACK(MoveViewport), NULL); |
66 g_signal_connect(handler, "select-all", G_CALLBACK(SelectAll), NULL); | 66 g_signal_connect(handler, "select-all", G_CALLBACK(SelectAll), NULL); |
67 g_signal_connect(handler, "toggle-cursor-visible", | 67 g_signal_connect(handler, "toggle-cursor-visible", |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void GtkKeyBindingsHandler::MoveFocus(GtkWidget* widget, | 316 void GtkKeyBindingsHandler::MoveFocus(GtkWidget* widget, |
317 GtkDirectionType arg1) { | 317 GtkDirectionType arg1) { |
318 // Just for disabling the default handler. | 318 // Just for disabling the default handler. |
319 #if !GTK_CHECK_VERSION(2, 14, 0) | 319 #if !GTK_CHECK_VERSION(2, 14, 0) |
320 // Before gtk 2.14.0, there is no way to override a non-virtual default signal | 320 // Before gtk 2.14.0, there is no way to override a non-virtual default signal |
321 // handler, so we need stop the signal emission explicitly to prevent the | 321 // handler, so we need stop the signal emission explicitly to prevent the |
322 // default handler from being executed. | 322 // default handler from being executed. |
323 g_signal_stop_emission_by_name(widget, "move-focus"); | 323 g_signal_stop_emission_by_name(widget, "move-focus"); |
324 #endif | 324 #endif |
325 } | 325 } |
OLD | NEW |