From 88b81c8eca1b399d8d48a8014e36e2d2ef0e4b96 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Tue, 8 Mar 2011 12:24:31 +0900 Subject: [PATCH] Bug 635857 - nsWindow::ResetInputState() commits duplicated composition string. r=mwu a=blocking-fennec --- embedding/android/GeckoAppShell.java | 21 ++++++++++++++++++--- embedding/android/GeckoSurfaceView.java | 1 - 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index 202c68f6c22..d0b85c8c964 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -428,8 +428,24 @@ public class GeckoAppShell switch (type) { case NOTIFY_IME_RESETINPUTSTATE: - GeckoApp.surfaceView.inputConnection.finishComposingText(); - IMEStateUpdater.resetIME(); + // Composition event is already fired from widget. + // So reset IME flags. + GeckoApp.surfaceView.inputConnection.reset(); + + // Don't use IMEStateUpdater for reset. + // Because IME may not work showSoftInput() + // after calling restartInput() immediately. + // So we have to call showSoftInput() delay. + InputMethodManager imm = (InputMethodManager) + GeckoApp.surfaceView.getContext().getSystemService( + Context.INPUT_METHOD_SERVICE); + if (imm == null) { + // no way to reset IME status directly + IMEStateUpdater.resetIME(); + } else { + imm.restartInput(GeckoApp.surfaceView); + } + // keep current enabled state IMEStateUpdater.enableIME(); break; @@ -439,7 +455,6 @@ public class GeckoAppShell break; case NOTIFY_IME_FOCUSCHANGE: - GeckoApp.surfaceView.mIMEFocus = state != 0; IMEStateUpdater.resetIME(); break; } diff --git a/embedding/android/GeckoSurfaceView.java b/embedding/android/GeckoSurfaceView.java index 072a0c8b2ff..c693d9e5583 100644 --- a/embedding/android/GeckoSurfaceView.java +++ b/embedding/android/GeckoSurfaceView.java @@ -582,7 +582,6 @@ class GeckoSurfaceView KeyListener mKeyListener; Editable mEditable; Editable.Factory mEditableFactory; - boolean mIMEFocus; int mIMEState; String mIMETypeHint; String mIMEActionHint;