| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/libgtk2ui/gtk2_key_bindings_handler.h" | 5 #include "chrome/browser/ui/libgtkui/gtk2_key_bindings_handler.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" | 17 #include "chrome/browser/ui/libgtkui/gtk2_util.h" |
| 18 #include "content/public/browser/native_web_keyboard_event.h" | 18 #include "content/public/browser/native_web_keyboard_event.h" |
| 19 #include "ui/base/ime/text_edit_commands.h" | 19 #include "ui/base/ime/text_edit_commands.h" |
| 20 #include "ui/base/x/x11_util.h" | 20 #include "ui/base/x/x11_util.h" |
| 21 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
| 22 | 22 |
| 23 using ui::TextEditCommand; | 23 using ui::TextEditCommand; |
| 24 | 24 |
| 25 // TODO(erg): Rewrite the old gtk_key_bindings_handler_unittest.cc and get them | 25 // TODO(erg): Rewrite the old gtk_key_bindings_handler_unittest.cc and get them |
| 26 // in a state that links. This code was adapted from the content layer GTK | 26 // in a state that links. This code was adapted from the content layer GTK |
| 27 // code, which had some simple unit tests. However, the changes in the public | 27 // code, which had some simple unit tests. However, the changes in the public |
| 28 // interface basically meant the tests need to be rewritten; this imposes weird | 28 // interface basically meant the tests need to be rewritten; this imposes weird |
| 29 // linking requirements regarding GTK+ as we don't have a libgtk2ui_unittests | 29 // linking requirements regarding GTK+ as we don't have a libgtkui_unittests |
| 30 // yet. http://crbug.com/358297. | 30 // yet. http://crbug.com/358297. |
| 31 | 31 |
| 32 namespace libgtk2ui { | 32 namespace libgtkui { |
| 33 | 33 |
| 34 Gtk2KeyBindingsHandler::Gtk2KeyBindingsHandler() | 34 Gtk2KeyBindingsHandler::Gtk2KeyBindingsHandler() |
| 35 : fake_window_(gtk_offscreen_window_new()), | 35 : fake_window_(gtk_offscreen_window_new()), |
| 36 handler_(CreateNewHandler()), | 36 handler_(CreateNewHandler()), |
| 37 has_xkb_(false) { | 37 has_xkb_(false) { |
| 38 gtk_container_add(GTK_CONTAINER(fake_window_), handler_); | 38 gtk_container_add(GTK_CONTAINER(fake_window_), handler_); |
| 39 | 39 |
| 40 int opcode, event, error; | 40 int opcode, event, error; |
| 41 int major = XkbMajorVersion; | 41 int major = XkbMajorVersion; |
| 42 int minor = XkbMinorVersion; | 42 int minor = XkbMinorVersion; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 GtkWidgetHelpType arg1) { | 429 GtkWidgetHelpType arg1) { |
| 430 // Just for disabling the default handler. | 430 // Just for disabling the default handler. |
| 431 return FALSE; | 431 return FALSE; |
| 432 } | 432 } |
| 433 | 433 |
| 434 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget, | 434 void Gtk2KeyBindingsHandler::MoveFocus(GtkWidget* widget, |
| 435 GtkDirectionType arg1) { | 435 GtkDirectionType arg1) { |
| 436 // Just for disabling the default handler. | 436 // Just for disabling the default handler. |
| 437 } | 437 } |
| 438 | 438 |
| 439 } // namespace libgtk2ui | 439 } // namespace libgtkui |
| OLD | NEW |