mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-22 19:45:40 +00:00
Fixed backspace being delivered after committed text on Android 12
Testing: Enter "hello ", followed by "?" - the events generated are: : commitText hello : Key pressed : scancode 11 = H, keycode 0x00000068 = H modifiers: (none) : Key released: scancode 11 = H, keycode 0x00000068 = H modifiers: (none) : Key pressed : scancode 8 = E, keycode 0x00000065 = E modifiers: (none) : Key released: scancode 8 = E, keycode 0x00000065 = E modifiers: (none) : Key pressed : scancode 15 = L, keycode 0x0000006C = L modifiers: (none) : Key released: scancode 15 = L, keycode 0x0000006C = L modifiers: (none) : Key pressed : scancode 15 = L, keycode 0x0000006C = L modifiers: (none) : Key released: scancode 15 = L, keycode 0x0000006C = L modifiers: (none) : Key pressed : scancode 18 = O, keycode 0x0000006F = O modifiers: (none) : Key released: scancode 18 = O, keycode 0x0000006F = O modifiers: (none) : Key pressed : scancode 44 = Space, keycode 0x00000020 = Space modifiers: (none) : Key released: scancode 44 = Space, keycode 0x00000020 = Space modifiers: (none) : INPUT Text (\x68\x65\x6c\x6c\x6f\x20): "hello " : finishComposingText : deleteSurroundingText 1 / 0 : Key pressed : scancode 42 = Backspace, keycode 0x00000008 = Backspace modifiers: (none) : Key released: scancode 42 = Backspace, keycode 0x00000008 = Backspace modifiers: (none) : commitText ? : Key pressed : scancode 225 = Left Shift, keycode 0x400000E1 = Left Shift modifiers: LSHIFT : Key pressed : scancode 56 = /, keycode 0x0000002F = / modifiers: (none) : Key released: scancode 56 = /, keycode 0x0000002F = / modifiers: (none) : Key released: scancode 225 = Left Shift, keycode 0x400000E1 = Left Shift modifiers: (none) : INPUT Text (\x3f): "?" : setComposingText , at 1 : EDIT Text (): "" Previously, the backspace would be delivered after the "?"
This commit is contained in:
parent
37a517dc36
commit
7ac5d616f3
|
@ -2390,14 +2390,11 @@ class SDLInputConnection extends BaseInputConnection {
|
|||
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions/14560344/android-backspace-in-webview-baseinputconnection
|
||||
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
|
||||
if (beforeLength > 0 && afterLength == 0) {
|
||||
boolean ret = true;
|
||||
// backspace(s)
|
||||
while (beforeLength-- > 0) {
|
||||
boolean ret_key = sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL))
|
||||
&& sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL));
|
||||
ret = ret && ret_key;
|
||||
nativeGenerateScancodeForUnichar('\b');
|
||||
}
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.deleteSurroundingText(beforeLength, afterLength);
|
||||
|
|
|
@ -45,7 +45,7 @@ static ASCIIKeyInfo SDL_ASCIIKeyInfoTable[] = {
|
|||
/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 8 */ { SDL_SCANCODE_BACKSPACE, 0 },
|
||||
/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 },
|
||||
|
|
Loading…
Reference in a new issue