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 "views/ime/input_method_ibus.h" | 5 #include "views/ime/input_method_ibus.h" |
6 | 6 |
7 #include <ibus.h> | 7 #include <ibus.h> |
8 | 8 |
9 #include <cstring> | 9 #include <cstring> |
10 #include <set> | 10 #include <set> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 *ibus_keyval = keysym; | 71 *ibus_keyval = keysym; |
72 *ibus_keycode = x_key->keycode; | 72 *ibus_keycode = x_key->keycode; |
73 } | 73 } |
74 #elif defined(TOOLKIT_USES_GTK) | 74 #elif defined(TOOLKIT_USES_GTK) |
75 if (key.gdk_event()) { | 75 if (key.gdk_event()) { |
76 GdkEventKey* gdk_key = reinterpret_cast<GdkEventKey*>(key.gdk_event()); | 76 GdkEventKey* gdk_key = reinterpret_cast<GdkEventKey*>(key.gdk_event()); |
77 *ibus_keyval = gdk_key->keyval; | 77 *ibus_keyval = gdk_key->keyval; |
78 *ibus_keycode = gdk_key->hardware_keycode; | 78 *ibus_keycode = gdk_key->hardware_keycode; |
79 } | 79 } |
80 #endif | 80 #endif |
| 81 #if defined(TOUCH_UI) || defined(TOOLKIT_USES_GTK) |
81 else { | 82 else { |
82 // GdkKeyCodeForWindowsKeyCode() is actually nothing to do with Gtk, we | 83 // GdkKeyCodeForWindowsKeyCode() is actually nothing to do with Gtk, we |
83 // probably want to rename it to something like XKeySymForWindowsKeyCode(), | 84 // probably want to rename it to something like XKeySymForWindowsKeyCode(), |
84 // because Gtk keyval is actually same as X KeySym. | 85 // because Gtk keyval is actually same as X KeySym. |
85 *ibus_keyval = ui::GdkKeyCodeForWindowsKeyCode( | 86 *ibus_keyval = ui::GdkKeyCodeForWindowsKeyCode( |
86 key.key_code(), key.IsShiftDown() ^ key.IsCapsLockDown()); | 87 key.key_code(), key.IsShiftDown() ^ key.IsCapsLockDown()); |
87 *ibus_keycode = 0; | 88 *ibus_keycode = 0; |
88 } | 89 } |
| 90 #endif |
89 | 91 |
90 *ibus_state = IBusStateFromViewsFlags(key.flags()); | 92 *ibus_state = IBusStateFromViewsFlags(key.flags()); |
91 if (key.type() == ui::ET_KEY_RELEASED) | 93 if (key.type() == ui::ET_KEY_RELEASED) |
92 *ibus_state |= IBUS_RELEASE_MASK; | 94 *ibus_state |= IBUS_RELEASE_MASK; |
93 } | 95 } |
94 | 96 |
95 void ExtractCompositionTextFromIBusPreedit(IBusText* text, | 97 void ExtractCompositionTextFromIBusPreedit(IBusText* text, |
96 guint cursor_position, | 98 guint cursor_position, |
97 ui::CompositionText* composition) { | 99 ui::CompositionText* composition) { |
98 composition->Clear(); | 100 composition->Clear(); |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 DCHECK_EQ(GetIBus(), bus); | 1013 DCHECK_EQ(GetIBus(), bus); |
1012 DCHECK(data); | 1014 DCHECK(data); |
1013 IBusInputContext* ic = | 1015 IBusInputContext* ic = |
1014 ibus_bus_create_input_context_async_finish(bus, res, NULL); | 1016 ibus_bus_create_input_context_async_finish(bus, res, NULL); |
1015 if (ic) | 1017 if (ic) |
1016 data->StoreOrAbandonInputContext(ic); | 1018 data->StoreOrAbandonInputContext(ic); |
1017 delete data; | 1019 delete data; |
1018 } | 1020 } |
1019 | 1021 |
1020 } // namespace views | 1022 } // namespace views |
OLD | NEW |