OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/ime/input_method_ibus.h" | 5 #include "ui/views/ime/input_method_ibus.h" |
6 | 6 |
7 #include <ibus.h> | 7 #include <ibus.h> |
8 #if defined(TOUCH_UI) | 8 #if defined(TOUCH_UI) |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/Xutil.h> | 10 #include <X11/Xutil.h> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
23 #include "base/third_party/icu/icu_utf.h" | 23 #include "base/third_party/icu/icu_utf.h" |
24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
25 #include "ui/base/keycodes/keyboard_codes.h" | 25 #include "ui/base/keycodes/keyboard_codes.h" |
26 #include "ui/gfx/point.h" | 26 #include "ui/gfx/point.h" |
27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
28 #include "ui/views/events/event.h" | 28 #include "ui/views/events/event.h" |
29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
30 | 30 |
31 #if defined(USE_AURA) || defined(TOUCH_UI) | 31 #if defined(USE_AURA) |
32 #include "ui/base/keycodes/keyboard_code_conversion_x.h" | 32 #include "ui/base/keycodes/keyboard_code_conversion_x.h" |
33 #elif defined(TOOLKIT_USES_GTK) | 33 #elif defined(TOOLKIT_USES_GTK) |
34 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" | 34 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" |
35 #endif | 35 #endif |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // A global flag to switch the InputMethod implementation to InputMethodIBus | 39 // A global flag to switch the InputMethod implementation to InputMethodIBus |
40 bool inputmethod_ibus_enabled = false; | 40 bool inputmethod_ibus_enabled = false; |
41 | 41 |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 } | 792 } |
793 } | 793 } |
794 | 794 |
795 void InputMethodIBus::OnForwardKeyEvent(IBusInputContext* context, | 795 void InputMethodIBus::OnForwardKeyEvent(IBusInputContext* context, |
796 guint keyval, | 796 guint keyval, |
797 guint keycode, | 797 guint keycode, |
798 guint state) { | 798 guint state) { |
799 DCHECK_EQ(context_, context); | 799 DCHECK_EQ(context_, context); |
800 | 800 |
801 ui::KeyboardCode key_code = ui::VKEY_UNKNOWN; | 801 ui::KeyboardCode key_code = ui::VKEY_UNKNOWN; |
802 #if defined(USE_AURA) || defined(TOUCH_UI) | 802 #if defined(USE_AURA) |
803 key_code = ui::KeyboardCodeFromXKeysym(keyval); | 803 key_code = ui::KeyboardCodeFromXKeysym(keyval); |
804 #elif defined(TOOLKIT_USES_GTK) | 804 #elif defined(TOOLKIT_USES_GTK) |
805 key_code = ui::WindowsKeyCodeForGdkKeyCode(keyval); | 805 key_code = ui::WindowsKeyCodeForGdkKeyCode(keyval); |
806 #endif | 806 #endif |
807 | 807 |
808 if (!key_code) | 808 if (!key_code) |
809 return; | 809 return; |
810 | 810 |
811 KeyEvent key(state & IBUS_RELEASE_MASK ? | 811 KeyEvent key(state & IBUS_RELEASE_MASK ? |
812 ui::ET_KEY_RELEASED : ui::ET_KEY_PRESSED, | 812 ui::ET_KEY_RELEASED : ui::ET_KEY_PRESSED, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 DCHECK_EQ(GetIBus(), bus); | 952 DCHECK_EQ(GetIBus(), bus); |
953 DCHECK(data); | 953 DCHECK(data); |
954 IBusInputContext* ic = | 954 IBusInputContext* ic = |
955 ibus_bus_create_input_context_async_finish(bus, res, NULL); | 955 ibus_bus_create_input_context_async_finish(bus, res, NULL); |
956 if (ic) | 956 if (ic) |
957 data->StoreOrAbandonInputContext(ic); | 957 data->StoreOrAbandonInputContext(ic); |
958 delete data; | 958 delete data; |
959 } | 959 } |
960 | 960 |
961 } // namespace views | 961 } // namespace views |
OLD | NEW |