Skip to content

Commit fc2f4fc

Browse files
committed
Send SDL_EVENT_SCREEN_KEYBOARD_HIDDEN when the keyboard is hidden on Android
1 parent 173adc1 commit fc2f4fc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

android-project/app/src/main/java/org/libsdl/app/SDLSurface.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
208208
WindowInsets.Type.displayCutout());
209209

210210
SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom);
211+
212+
if (insets.isVisible(WindowInsets.Type.ime())) {
213+
SDLActivity.onNativeScreenKeyboardShown();
214+
} else {
215+
SDLActivity.onNativeScreenKeyboardHidden();
216+
}
211217
}
212218

213219
// Pass these to any child views in case they need them

src/video/SDL_video.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5900,7 +5900,7 @@ bool SDL_ScreenKeyboardShown(SDL_Window *window)
59005900

59015901
void SDL_SendScreenKeyboardShown(void)
59025902
{
5903-
if (_this->screen_keyboard_shown) {
5903+
if (!_this || _this->screen_keyboard_shown) {
59045904
return;
59055905
}
59065906

@@ -5916,7 +5916,7 @@ void SDL_SendScreenKeyboardShown(void)
59165916

59175917
void SDL_SendScreenKeyboardHidden(void)
59185918
{
5919-
if (!_this->screen_keyboard_shown) {
5919+
if (!_this || !_this->screen_keyboard_shown) {
59205920
return;
59215921
}
59225922

0 commit comments

Comments
 (0)