From 22a6d76f2295ccc22353b6372b27181615c71e08 Mon Sep 17 00:00:00 2001
From: Tobiasz Laskowski <[EMAIL REDACTED]>
Date: Wed, 4 Mar 2026 03:42:52 +0000
Subject: [PATCH] Backport android api 30+ fix for backspace to SDL2
---
.../main/java/org/libsdl/app/SDLActivity.java | 20 +++++++++----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index 889326814c12d..ef77381b50345 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -2008,17 +2008,15 @@ public boolean setComposingText(CharSequence text, int newCursorPosition) {
@Override
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
- if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
- // 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) {
- // backspace(s)
- while (beforeLength-- > 0) {
- nativeGenerateScancodeForUnichar('\b');
- }
- return true;
- }
- }
+ // 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) {
+ // backspace(s)
+ while (beforeLength-- > 0) {
+ nativeGenerateScancodeForUnichar('\b');
+ }
+ return true;
+ }
if (!super.deleteSurroundingText(beforeLength, afterLength)) {
return false;