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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 const View* old_focused_view = focused_view(); | 720 const View* old_focused_view = focused_view(); |
721 DispatchKeyEventPostIME(key); | 721 DispatchKeyEventPostIME(key); |
722 | 722 |
723 // We shouldn't dispatch the character anymore if the key event caused focus | 723 // We shouldn't dispatch the character anymore if the key event caused focus |
724 // change. | 724 // change. |
725 if (old_focused_view != focused_view()) | 725 if (old_focused_view != focused_view()) |
726 return; | 726 return; |
727 | 727 |
728 // Process compose and dead keys | 728 // Process compose and dead keys |
729 if (character_composer_.FilterKeyPress(ibus_keyval)) { | 729 if (character_composer_.FilterKeyPress(ibus_keyval)) { |
730 string16 composed = character_composer_.GetComposedCharacter(); | 730 string16 composed = character_composer_.composed_character(); |
731 if (!composed.empty()) { | 731 if (!composed.empty()) { |
732 TextInputClient* client = GetTextInputClient(); | 732 TextInputClient* client = GetTextInputClient(); |
733 if (client) | 733 if (client) |
734 client->InsertText(composed); | 734 client->InsertText(composed); |
735 } | 735 } |
736 return; | 736 return; |
737 } | 737 } |
738 // If a key event was not filtered by |context_| and |character_composer_|, | 738 // If a key event was not filtered by |context_| and |character_composer_|, |
739 // then it means the key event didn't generate any result text. So we need | 739 // then it means the key event didn't generate any result text. So we need |
740 // to send corresponding character to the focused text input client. | 740 // to send corresponding character to the focused text input client. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 DCHECK_EQ(GetIBus(), bus); | 1003 DCHECK_EQ(GetIBus(), bus); |
1004 DCHECK(data); | 1004 DCHECK(data); |
1005 IBusInputContext* ic = | 1005 IBusInputContext* ic = |
1006 ibus_bus_create_input_context_async_finish(bus, res, NULL); | 1006 ibus_bus_create_input_context_async_finish(bus, res, NULL); |
1007 if (ic) | 1007 if (ic) |
1008 data->StoreOrAbandonInputContext(ic); | 1008 data->StoreOrAbandonInputContext(ic); |
1009 delete data; | 1009 delete data; |
1010 } | 1010 } |
1011 | 1011 |
1012 } // namespace views | 1012 } // namespace views |
OLD | NEW |