Browse Source

Merge commit '7ac5d616f3732b4d98010331d2ae0a24f883092d' into main

Sam Lantinga 2 years ago
parent
commit
6d3ce729a6

+ 2 - 5
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

@@ -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);

+ 1 - 1
src/events/scancodes_ascii.h

@@ -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 },