Commit 2af0d65f authored by nona@chromium.org's avatar nona@chromium.org

Remove IBus specific hack from InputMethodIBus.

BUG=None
TEST=None, just working fine.

Review URL: https://chromiumcodereview.appspot.com/22909048

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221394 0039d316-1c4b-4281-b951-d872f2087c98
parent ce5916aa
...@@ -91,7 +91,6 @@ InputMethodIBus::InputMethodIBus( ...@@ -91,7 +91,6 @@ InputMethodIBus::InputMethodIBus(
context_focused_(false), context_focused_(false),
composing_text_(false), composing_text_(false),
composition_changed_(false), composition_changed_(false),
suppress_next_result_(false),
current_keyevent_id_(0), current_keyevent_id_(0),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
SetDelegate(delegate); SetDelegate(delegate);
...@@ -233,10 +232,6 @@ bool InputMethodIBus::DispatchKeyEvent(const base::NativeEvent& native_event) { ...@@ -233,10 +232,6 @@ bool InputMethodIBus::DispatchKeyEvent(const base::NativeEvent& native_event) {
callback, callback,
base::Bind(callback, false)); base::Bind(callback, false));
++current_keyevent_id_; ++current_keyevent_id_;
// We don't want to suppress the result generated by this key event, but it
// may cause problem. See comment in ResetContext() method.
suppress_next_result_ = false;
return true; return true;
} }
...@@ -429,16 +424,6 @@ void InputMethodIBus::ResetContext() { ...@@ -429,16 +424,6 @@ void InputMethodIBus::ResetContext() {
DCHECK(system_toplevel_window_focused()); DCHECK(system_toplevel_window_focused());
// Because ibus runs in asynchronous mode, the input method may still send us
// results after sending out the reset request, so we use a flag to discard
// all results generated by previous key events. But because ibus does not
// have a mechanism to identify each key event and corresponding results, this
// approach will not work for some corner cases. For example if the user types
// very fast, then the next key event may come in before the |context_| is
// really reset. Then we actually cannot know whether or not the next
// result should be discard.
suppress_next_result_ = true;
composition_.Clear(); composition_.Clear();
result_text_.clear(); result_text_.clear();
composing_text_ = false; composing_text_ = false;
...@@ -667,7 +652,7 @@ void InputMethodIBus::AbandonAllPendingKeyEvents() { ...@@ -667,7 +652,7 @@ void InputMethodIBus::AbandonAllPendingKeyEvents() {
} }
void InputMethodIBus::CommitText(const chromeos::IBusText& text) { void InputMethodIBus::CommitText(const chromeos::IBusText& text) {
if (suppress_next_result_ || text.text().empty()) if (text.text().empty())
return; return;
// We need to receive input method result even if the text input type is // We need to receive input method result even if the text input type is
...@@ -719,7 +704,7 @@ void InputMethodIBus::ForwardKeyEvent(uint32 keyval, ...@@ -719,7 +704,7 @@ void InputMethodIBus::ForwardKeyEvent(uint32 keyval,
} }
void InputMethodIBus::ShowPreeditText() { void InputMethodIBus::ShowPreeditText() {
if (suppress_next_result_ || IsTextInputTypeNone()) if (IsTextInputTypeNone())
return; return;
composing_text_ = true; composing_text_ = true;
...@@ -728,7 +713,7 @@ void InputMethodIBus::ShowPreeditText() { ...@@ -728,7 +713,7 @@ void InputMethodIBus::ShowPreeditText() {
void InputMethodIBus::UpdatePreeditText(const chromeos::IBusText& text, void InputMethodIBus::UpdatePreeditText(const chromeos::IBusText& text,
uint32 cursor_pos, uint32 cursor_pos,
bool visible) { bool visible) {
if (suppress_next_result_ || IsTextInputTypeNone()) if (IsTextInputTypeNone())
return; return;
// |visible| argument is very confusing. For example, what's the correct // |visible| argument is very confusing. For example, what's the correct
...@@ -860,7 +845,6 @@ bool InputMethodIBus::ExecuteCharacterComposer(uint32 ibus_keyval, ...@@ -860,7 +845,6 @@ bool InputMethodIBus::ExecuteCharacterComposer(uint32 ibus_keyval,
ibus_keycode, ibus_keycode,
EventFlagsFromXState(ibus_state)); EventFlagsFromXState(ibus_state));
suppress_next_result_ = false;
chromeos::IBusText preedit; chromeos::IBusText preedit;
preedit.set_text( preedit.set_text(
UTF16ToUTF8(character_composer_.preedit_string())); UTF16ToUTF8(character_composer_.preedit_string()));
......
...@@ -214,10 +214,6 @@ class UI_EXPORT InputMethodIBus ...@@ -214,10 +214,6 @@ class UI_EXPORT InputMethodIBus
// Indicates if the composition text is changed or deleted. // Indicates if the composition text is changed or deleted.
bool composition_changed_; bool composition_changed_;
// If it's true then all input method result received before the next key
// event will be discarded.
bool suppress_next_result_;
// The latest id of key event. // The latest id of key event.
uint32 current_keyevent_id_; uint32 current_keyevent_id_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment