Skip to content

Commit

Permalink
backout SDL_AndroidSetInputType()
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Oct 17, 2021
1 parent 6ef3bc5 commit 8b1a2fe
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ public enum NativeState {
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
public static boolean mBrokenLibraries = true;

public static int mInputType = 1;

// Main components
protected static SDLActivity mSingleton;
protected static SDLSurface mSurface;
Expand Down Expand Up @@ -1186,14 +1184,6 @@ public static boolean isTextInputEvent(KeyEvent event) {
return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
}

/**
* This method is called by SDL using JNI.
*/
public static int setInputType(int type) {
mInputType = type;
return 0;
}

/**
* This method is called by SDL using JNI.
*/
Expand Down Expand Up @@ -2192,14 +2182,7 @@ public boolean onKeyPreIme (int keyCode, KeyEvent event) {
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);

if (SDLActivity.mInputType == 0) {
/* 0 normal: use input method */
outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
} else {
/* 1 password (default): can not use input method,just use english */
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
}

outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;

Expand Down
11 changes: 0 additions & 11 deletions include/SDL_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis
*/
extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);

/* Set Android IME Input Type
* Call this method before calling SDL_StartTextInput()
*
* \param type
* 0 normal: use input method
* 1 password (default): can not use input method,just use english
*
* \returns 0 if success, -1 if any error occurs.
*/
extern DECLSPEC int SDLCALL SDL_AndroidSetInputType(int type);

#endif /* __ANDROID__ */

/* Platform specific functions for WinRT */
Expand Down
11 changes: 0 additions & 11 deletions src/core/android/SDL_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ static jmethodID midShowToast;
static jmethodID midSendMessage;
static jmethodID midSetActivityTitle;
static jmethodID midSetCustomCursor;
static jmethodID midSetInputType;
static jmethodID midSetOrientation;
static jmethodID midSetRelativeMouseEnabled;
static jmethodID midSetSystemCursor;
Expand Down Expand Up @@ -596,7 +595,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z");
midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle","(Ljava/lang/String;)Z");
midSetCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setCustomCursor", "(I)Z");
midSetInputType = (*env)->GetStaticMethodID(env, mActivityClass, "setInputType", "(I)I");
midSetOrientation = (*env)->GetStaticMethodID(env, mActivityClass, "setOrientation","(IIZLjava/lang/String;)V");
midSetRelativeMouseEnabled = (*env)->GetStaticMethodID(env, mActivityClass, "setRelativeMouseEnabled", "(Z)Z");
midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z");
Expand Down Expand Up @@ -627,7 +625,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
!midSendMessage ||
!midSetActivityTitle ||
!midSetCustomCursor ||
!midSetInputType ||
!midSetOrientation ||
!midSetRelativeMouseEnabled ||
!midSetSystemCursor ||
Expand Down Expand Up @@ -2456,14 +2453,6 @@ int SDL_AndroidShowToast(const char* message, int duration, int gravity, int xOf
return Android_JNI_ShowToast(message, duration, gravity, xOffset, yOffset);
}

int SDL_AndroidSetInputType(int type)
{
int result = 0;
JNIEnv *env = Android_JNI_GetEnv();
result = (*env)->CallStaticIntMethod(env, mActivityClass, midSetInputType, type);
return result;
}

void Android_JNI_GetManifestEnvironmentVariables(void)
{
if (!mActivityClass || !midGetManifestEnvironmentVariables) {
Expand Down
1 change: 0 additions & 1 deletion src/dynapi/SDL_dynapi_overrides.h
Original file line number Diff line number Diff line change
Expand Up @@ -822,4 +822,3 @@
#define SDL_RenderSetVSync SDL_RenderSetVSync_REAL
#define SDL_asprintf SDL_asprintf_REAL
#define SDL_vasprintf SDL_vasprintf_REAL
#define SDL_AndroidSetInputType SDL_AndroidSetInputType_REAL
3 changes: 0 additions & 3 deletions src/dynapi/SDL_dynapi_procs.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,3 @@ SDL_DYNAPI_PROC(int,SDL_RenderSetVSync,(SDL_Renderer *a, int b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return)
#endif
SDL_DYNAPI_PROC(int,SDL_vasprintf,(char **a, const char *b, va_list c),(a,b,c),return)
#ifdef __ANDROID__
SDL_DYNAPI_PROC(int,SDL_AndroidSetInputType,(int a),(a),return)
#endif

0 comments on commit 8b1a2fe

Please sign in to comment.