| 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 #ifndef VIEWS_IME_INPUT_METHOD_IBUS_H_ | 5 #ifndef VIEWS_IME_INPUT_METHOD_IBUS_H_ |
| 6 #define VIEWS_IME_INPUT_METHOD_IBUS_H_ | 6 #define VIEWS_IME_INPUT_METHOD_IBUS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "ui/base/gtk/gtk_signal.h" | 15 #include "ui/base/gtk/gtk_signal.h" |
| 16 #include "views/events/event.h" | 16 #include "views/events/event.h" |
| 17 #include "views/ime/character_composer.h" | 17 #include "views/ime/character_composer.h" |
| 18 #include "views/ime/input_method_base.h" | 18 #include "views/ime/input_method_base.h" |
| 19 #include "views/view.h" | 19 #include "views/view.h" |
| 20 | 20 |
| 21 // Forward declarations, so that we don't need to include ibus.h in this file. | 21 // Forward declarations, so that we don't need to include ibus.h and glib.h in |
| 22 // this file. |
| 23 typedef struct _GAsyncResult GAsyncResult; |
| 22 typedef struct _IBusBus IBusBus; | 24 typedef struct _IBusBus IBusBus; |
| 23 typedef struct _IBusInputContext IBusInputContext; | 25 typedef struct _IBusInputContext IBusInputContext; |
| 24 typedef struct _IBusText IBusText; | 26 typedef struct _IBusText IBusText; |
| 25 | 27 |
| 26 namespace views { | 28 namespace views { |
| 27 | 29 |
| 28 // An InputMethod implementation based on IBus. | 30 // An InputMethod implementation based on IBus. |
| 29 class InputMethodIBus : public InputMethodBase { | 31 class InputMethodIBus : public InputMethodBase { |
| 30 public: | 32 public: |
| 31 explicit InputMethodIBus(internal::InputMethodDelegate* delegate); | 33 explicit InputMethodIBus(internal::InputMethodDelegate* delegate); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void ResetContext(); | 82 void ResetContext(); |
| 81 | 83 |
| 82 // Checks the availability of focused text input client and update focus state | 84 // Checks the availability of focused text input client and update focus state |
| 83 // of |context_| and |context_simple_| accordingly. | 85 // of |context_| and |context_simple_| accordingly. |
| 84 void UpdateContextFocusState(); | 86 void UpdateContextFocusState(); |
| 85 | 87 |
| 86 // Updates focus state of |fake_context_| accordingly. | 88 // Updates focus state of |fake_context_| accordingly. |
| 87 void UpdateFakeContextFocusState(); | 89 void UpdateFakeContextFocusState(); |
| 88 | 90 |
| 89 // Process a key returned from the input method. | 91 // Process a key returned from the input method. |
| 90 void ProcessKeyEventPostIME(const KeyEvent& key, guint32 ibus_keycode, | 92 void ProcessKeyEventPostIME(const KeyEvent& key, unsigned int ibus_keycode, |
| 91 bool handled); | 93 bool handled); |
| 92 | 94 |
| 93 // Processes a key event that was already filtered by the input method. | 95 // Processes a key event that was already filtered by the input method. |
| 94 // A VKEY_PROCESSKEY may be dispatched to the focused View. | 96 // A VKEY_PROCESSKEY may be dispatched to the focused View. |
| 95 void ProcessFilteredKeyPressEvent(const KeyEvent& key); | 97 void ProcessFilteredKeyPressEvent(const KeyEvent& key); |
| 96 | 98 |
| 97 // Processes a key event that was not filtered by the input method. | 99 // Processes a key event that was not filtered by the input method. |
| 98 void ProcessUnfilteredKeyPressEvent(const KeyEvent& key, | 100 void ProcessUnfilteredKeyPressEvent(const KeyEvent& key, |
| 99 guint32 ibus_keycode); | 101 unsigned int ibus_keycode); |
| 100 | 102 |
| 101 // Sends input method result caused by the given key event to the focused text | 103 // Sends input method result caused by the given key event to the focused text |
| 102 // input client. | 104 // input client. |
| 103 void ProcessInputMethodResult(const KeyEvent& key, bool filtered); | 105 void ProcessInputMethodResult(const KeyEvent& key, bool filtered); |
| 104 | 106 |
| 105 // Checks if the pending input method result needs inserting into the focused | 107 // Checks if the pending input method result needs inserting into the focused |
| 106 // text input client as a single character. | 108 // text input client as a single character. |
| 107 bool NeedInsertChar() const; | 109 bool NeedInsertChar() const; |
| 108 | 110 |
| 109 // Checks if there is pending input method result. | 111 // Checks if there is pending input method result. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // An object to compose a character from a sequence of key presses | 200 // An object to compose a character from a sequence of key presses |
| 199 // including dead key etc. | 201 // including dead key etc. |
| 200 CharacterComposer character_composer_; | 202 CharacterComposer character_composer_; |
| 201 | 203 |
| 202 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); | 204 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 } // namespace views | 207 } // namespace views |
| 206 | 208 |
| 207 #endif // VIEWS_IME_INPUT_METHOD_IBUS_H_ | 209 #endif // VIEWS_IME_INPUT_METHOD_IBUS_H_ |
| OLD | NEW |