mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-29 18:11:38 +00:00
Renamed ShowTextInput/HideTextInput to ShowScreenKeyboard/HideScreenKeyboard on Android
This better reflects the actual implementation and makes SDL_HINT_ENABLE_SCREEN_KEYBOARD work on Android.
Fixes https://github.com/libsdl-org/SDL/issues/8652
(cherry picked from commit 014a63b4b5)
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "SDL_androidevents.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_androidkeyboard.h"
|
||||
#include "SDL_androidwindow.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
@@ -149,8 +150,9 @@ void Android_PumpEvents_Blocking(_THIS)
|
||||
#endif
|
||||
|
||||
/* Make sure SW Keyboard is restored when an app becomes foreground */
|
||||
if (SDL_IsTextInputActive()) {
|
||||
Android_StartTextInput(_this); /* Only showTextInput */
|
||||
if (SDL_IsTextInputActive() &&
|
||||
SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) {
|
||||
Android_ShowScreenKeyboard(_this, Android_Window); /* Only showTextInput */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -233,8 +235,9 @@ void Android_PumpEvents_NonBlocking(_THIS)
|
||||
#endif
|
||||
|
||||
/* Make sure SW Keyboard is restored when an app becomes foreground */
|
||||
if (SDL_IsTextInputActive()) {
|
||||
Android_StartTextInput(_this); /* Only showTextInput */
|
||||
if (SDL_IsTextInputActive() &&
|
||||
SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) {
|
||||
Android_ShowScreenKeyboard(_this, Android_Window); /* Only showTextInput */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -341,22 +341,22 @@ SDL_bool Android_HasScreenKeyboardSupport(_THIS)
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void Android_ShowScreenKeyboard(_THIS, SDL_Window *window)
|
||||
{
|
||||
SDL_VideoData *videodata = _this->driverdata;
|
||||
Android_JNI_ShowScreenKeyboard(&videodata->textRect);
|
||||
}
|
||||
|
||||
void Android_HideScreenKeyboard(_THIS, SDL_Window *window)
|
||||
{
|
||||
Android_JNI_HideScreenKeyboard();
|
||||
}
|
||||
|
||||
SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window)
|
||||
{
|
||||
return Android_JNI_IsScreenKeyboardShown();
|
||||
}
|
||||
|
||||
void Android_StartTextInput(_THIS)
|
||||
{
|
||||
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
|
||||
Android_JNI_ShowTextInput(&videodata->textRect);
|
||||
}
|
||||
|
||||
void Android_StopTextInput(_THIS)
|
||||
{
|
||||
Android_JNI_HideTextInput();
|
||||
}
|
||||
|
||||
void Android_SetTextInputRect(_THIS, const SDL_Rect *rect)
|
||||
{
|
||||
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
|
||||
|
||||
@@ -26,10 +26,9 @@ extern int Android_OnKeyDown(int keycode);
|
||||
extern int Android_OnKeyUp(int keycode);
|
||||
|
||||
extern SDL_bool Android_HasScreenKeyboardSupport(_THIS);
|
||||
extern void Android_ShowScreenKeyboard(_THIS, SDL_Window *window);
|
||||
extern void Android_HideScreenKeyboard(_THIS, SDL_Window *window);
|
||||
extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window);
|
||||
|
||||
extern void Android_StartTextInput(_THIS);
|
||||
extern void Android_StopTextInput(_THIS);
|
||||
extern void Android_SetTextInputRect(_THIS, const SDL_Rect *rect);
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -148,12 +148,12 @@ static SDL_VideoDevice *Android_CreateDevice(void)
|
||||
device->SuspendScreenSaver = Android_SuspendScreenSaver;
|
||||
|
||||
/* Text input */
|
||||
device->StartTextInput = Android_StartTextInput;
|
||||
device->StopTextInput = Android_StopTextInput;
|
||||
device->SetTextInputRect = Android_SetTextInputRect;
|
||||
|
||||
/* Screen keyboard */
|
||||
device->HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport;
|
||||
device->ShowScreenKeyboard = Android_ShowScreenKeyboard;
|
||||
device->HideScreenKeyboard = Android_HideScreenKeyboard;
|
||||
device->IsScreenKeyboardShown = Android_IsScreenKeyboardShown;
|
||||
|
||||
/* Clipboard */
|
||||
|
||||
Reference in New Issue
Block a user