Added SDL_EVENT_SCREEN_KEYBOARD_SHOWN and SDL_EVENT_SCREEN_KEYBOARD_HIDDEN

Fixes https://github.com/libsdl-org/SDL/issues/13049
This commit is contained in:
Sam Lantinga committed 2025-10-10 10:14:07 -07:00
1 parent 5441d33c0e
commit 1871b998cd
29 files changed
+110 -121

No files matched your search

-5
View File
@@ -156,11 +156,6 @@ static void Android_OnResume(void)
}
#endif
// Make sure SW Keyboard is restored when an app becomes foreground
if (Android_Window) {
Android_RestoreScreenKeyboardOnResume(SDL_GetVideoDevice(), Android_Window);
}
SDL_OnApplicationDidEnterForeground();
}
+2 -11
View File
@@ -353,8 +353,6 @@ static SDL_Scancode Android_Keycodes[] = {
SDL_SCANCODE_PASTE, // AKEYCODE_PASTE
};
static bool SDL_screen_keyboard_shown;
static SDL_Scancode TranslateKeycode(int keycode)
{
SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN;
@@ -444,25 +442,18 @@ void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_
}
}
Android_JNI_ShowScreenKeyboard(input_type, &window->text_input_rect);
SDL_screen_keyboard_shown = true;
}
void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
{
Android_JNI_HideScreenKeyboard();
SDL_screen_keyboard_shown = false;
}
void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window)
void Android_RestoreScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
{
if (SDL_screen_keyboard_shown) {
if (_this->screen_keyboard_shown) {
Android_ShowScreenKeyboard(_this, window, window->text_input_props);
}
}
bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
{
return Android_JNI_IsScreenKeyboardShown();
}
#endif // SDL_VIDEO_DRIVER_ANDROID
+1 -2
View File
@@ -28,5 +28,4 @@ extern void Android_OnKeyUp(int keycode);
extern bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
extern void Android_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props);
extern void Android_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window);
extern void Android_RestoreScreenKeyboardOnResume(SDL_VideoDevice *_this, SDL_Window *window);
extern bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window);
extern void Android_RestoreScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window);
-1
View File
@@ -142,7 +142,6 @@ static SDL_VideoDevice *Android_CreateDevice(void)
device->HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport;
device->ShowScreenKeyboard = Android_ShowScreenKeyboard;
device->HideScreenKeyboard = Android_HideScreenKeyboard;
device->IsScreenKeyboardShown = Android_IsScreenKeyboardShown;
// Clipboard
device->SetClipboardText = Android_SetClipboardText;