mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 725170 - Reset IME selection when Fennec resumes. r=dougt
This commit is contained in:
parent
544a50dece
commit
04d373eb1c
@ -2109,6 +2109,10 @@ abstract public class GeckoApp
|
||||
mMainHandler.sendMessage(message);
|
||||
}
|
||||
|
||||
// An Android framework bug can cause an IME crash when focus changes invalidate text
|
||||
// selection offsets. A workaround is to reset selection when the activity resumes.
|
||||
GeckoAppShell.resetIMESelection();
|
||||
|
||||
int newOrientation = getResources().getConfiguration().orientation;
|
||||
|
||||
if (mOrientation != newOrientation) {
|
||||
|
@ -579,6 +579,12 @@ public class GeckoAppShell
|
||||
mInputConnection.returnIMEQueryResult(result, selectionStart, selectionLength);
|
||||
}
|
||||
|
||||
public static void resetIMESelection() {
|
||||
if (mInputConnection != null) {
|
||||
mInputConnection.resetSelection();
|
||||
}
|
||||
}
|
||||
|
||||
static void onXreExit() {
|
||||
// mLaunchState can only be Launched or GeckoRunning at this point
|
||||
GeckoApp.setLaunchState(GeckoApp.LaunchState.GeckoExiting);
|
||||
|
@ -912,6 +912,18 @@ public class GeckoInputConnection
|
||||
Selection.setSelection(mEditable, contents.length());
|
||||
}
|
||||
|
||||
public void resetSelection() {
|
||||
// An Android framework bug can cause a SpannableStringBuilder crash when focus changes
|
||||
// invalidate text selection offsets. A workaround is to reset selection when the activity
|
||||
// resumes. More info: https://code.google.com/p/android/issues/detail?id=5164
|
||||
Editable content = getEditable();
|
||||
if (content != null) {
|
||||
Log.d(LOGTAG, "IME: resetSelection");
|
||||
int length = content.length();
|
||||
setSelection(length, length);
|
||||
}
|
||||
}
|
||||
|
||||
// Is a composition active?
|
||||
private boolean mComposing;
|
||||
private int mCompositionStart = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user