mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-05-12 14:52:15 +00:00
Fixed bug #4843 - Can not get the ime candidatelist like chinese/japaness input method
This commit is contained in:
parent
7fb4364391
commit
ccb12457f9
|
@ -102,6 +102,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
||||||
public static boolean mBrokenLibraries = true;
|
public static boolean mBrokenLibraries = true;
|
||||||
|
|
||||||
|
public static int mInputType = 1;
|
||||||
|
|
||||||
// Main components
|
// Main components
|
||||||
protected static SDLActivity mSingleton;
|
protected static SDLActivity mSingleton;
|
||||||
protected static SDLSurface mSurface;
|
protected static SDLSurface mSurface;
|
||||||
|
@ -1184,6 +1186,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
|
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.
|
* This method is called by SDL using JNI.
|
||||||
*/
|
*/
|
||||||
|
@ -2182,7 +2192,14 @@ class DummyEdit extends View implements View.OnKeyListener {
|
||||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||||
ic = new SDLInputConnection(this, true);
|
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
|
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||||
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;
|
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;
|
||||||
|
|
||||||
|
|
|
@ -395,6 +395,17 @@ 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);
|
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__ */
|
#endif /* __ANDROID__ */
|
||||||
|
|
||||||
/* Platform specific functions for WinRT */
|
/* Platform specific functions for WinRT */
|
||||||
|
|
|
@ -316,6 +316,7 @@ static jmethodID midShowToast;
|
||||||
static jmethodID midSendMessage;
|
static jmethodID midSendMessage;
|
||||||
static jmethodID midSetActivityTitle;
|
static jmethodID midSetActivityTitle;
|
||||||
static jmethodID midSetCustomCursor;
|
static jmethodID midSetCustomCursor;
|
||||||
|
static jmethodID midSetInputType;
|
||||||
static jmethodID midSetOrientation;
|
static jmethodID midSetOrientation;
|
||||||
static jmethodID midSetRelativeMouseEnabled;
|
static jmethodID midSetRelativeMouseEnabled;
|
||||||
static jmethodID midSetSystemCursor;
|
static jmethodID midSetSystemCursor;
|
||||||
|
@ -595,6 +596,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
|
||||||
midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z");
|
midSendMessage = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z");
|
||||||
midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle","(Ljava/lang/String;)Z");
|
midSetActivityTitle = (*env)->GetStaticMethodID(env, mActivityClass, "setActivityTitle","(Ljava/lang/String;)Z");
|
||||||
midSetCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setCustomCursor", "(I)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");
|
midSetOrientation = (*env)->GetStaticMethodID(env, mActivityClass, "setOrientation","(IIZLjava/lang/String;)V");
|
||||||
midSetRelativeMouseEnabled = (*env)->GetStaticMethodID(env, mActivityClass, "setRelativeMouseEnabled", "(Z)Z");
|
midSetRelativeMouseEnabled = (*env)->GetStaticMethodID(env, mActivityClass, "setRelativeMouseEnabled", "(Z)Z");
|
||||||
midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z");
|
midSetSystemCursor = (*env)->GetStaticMethodID(env, mActivityClass, "setSystemCursor", "(I)Z");
|
||||||
|
@ -625,6 +627,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
|
||||||
!midSendMessage ||
|
!midSendMessage ||
|
||||||
!midSetActivityTitle ||
|
!midSetActivityTitle ||
|
||||||
!midSetCustomCursor ||
|
!midSetCustomCursor ||
|
||||||
|
!midSetInputType ||
|
||||||
!midSetOrientation ||
|
!midSetOrientation ||
|
||||||
!midSetRelativeMouseEnabled ||
|
!midSetRelativeMouseEnabled ||
|
||||||
!midSetSystemCursor ||
|
!midSetSystemCursor ||
|
||||||
|
@ -2453,6 +2456,14 @@ int SDL_AndroidShowToast(const char* message, int duration, int gravity, int xOf
|
||||||
return Android_JNI_ShowToast(message, duration, gravity, xOffset, yOffset);
|
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)
|
void Android_JNI_GetManifestEnvironmentVariables(void)
|
||||||
{
|
{
|
||||||
if (!mActivityClass || !midGetManifestEnvironmentVariables) {
|
if (!mActivityClass || !midGetManifestEnvironmentVariables) {
|
||||||
|
|
Loading…
Reference in a new issue