Skip to content

Commit

Permalink
Fix for on-screen keymapping dialog, it's still buggy yet
Browse files Browse the repository at this point in the history
  • Loading branch information
pelya committed Dec 20, 2010
1 parent eef775d commit e34e40f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 5 additions & 3 deletions project/java/Settings.java
Expand Up @@ -1099,7 +1099,7 @@ static void Apply(Activity p)
nativeSetTouchscreenKeyboardUsed();
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
Globals.TouchscreenKeyboardTheme,
7, // Globals.AppTouchscreenKeyboardKeysAmount, - set later by nativeSetScreenKbKeyUsed()
8, // Globals.AppTouchscreenKeyboardKeysAmount, - set later by nativeSetScreenKbKeyUsed()
Globals.AppTouchscreenKeyboardKeysAmountAutoFire,
1, //Globals.AppNeedsArrowKeys ? 1 : 0,
1 ); //Globals.AppNeedsTextInput ? 1 : 0 );
Expand All @@ -1113,8 +1113,10 @@ static void Apply(Activity p)
for( int i = 0; i < Globals.ScreenKbControlsShown.length; i++ )
{
nativeSetScreenKbKeyUsed(i, Globals.ScreenKbControlsShown[i] ? 1 : 0);
if( i >= 2 )
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i-2]]);
}
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
{
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
}

String lang = new String(Locale.getDefault().getLanguage());
Expand Down
2 changes: 2 additions & 0 deletions project/jni/sdl-1.3/src/video/android/SDL_androidinput.c
Expand Up @@ -1329,6 +1329,7 @@ JAVA_EXPORT_NAME(Settings_nativeGetKeymapKeyScreenKb) ( JNIEnv* env, jobject th
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetKeymapKeyScreenKb) ( JNIEnv* env, jobject thiz, jint keynum, jint key)
{
__android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeSetKeymapKeyScreenKb(): %d %d", keynum, key);
if( keynum < 0 || keynum > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 + 4 )
return;

Expand All @@ -1340,6 +1341,7 @@ JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetScreenKbKeyUsed) ( JNIEnv* env, jobject thiz, jint keynum, jint used)
{
SDL_Rect rect = {0, 0, 0, 0};
__android_log_print(ANDROID_LOG_INFO, "libSDL", "nativeSetScreenKbKeyUsed(): %d %d", keynum, used);
int key = -1;
if( keynum == 0 )
key = SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD;
Expand Down
Expand Up @@ -649,7 +649,7 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
int i, ii;
int nbuttons1row, nbuttons2row;
touchscreenKeyboardTheme = theme;
if( _nbuttons > MAX_BUTTONS )
if( _nbuttons >= MAX_BUTTONS )
_nbuttons = MAX_BUTTONS;
AutoFireButtonsNum = nbuttonsAutoFire;
if( AutoFireButtonsNum > MAX_BUTTONS_AUTOFIRE )
Expand Down Expand Up @@ -736,6 +736,8 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
buttons[6].h = SDL_ANDROID_sWindowHeight/10;
}

for( i = 0; i < MAX_BUTTONS; i++ )
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboard(): button %d pos %d %d %d %d", i, (int)buttons[i].x, (int)buttons[i].y, (int)buttons[i].w, (int)buttons[i].h);
if( !showArrows )
{
arrows.w = 0;
Expand All @@ -761,6 +763,8 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
buttonsAutoFireRect[i].x = buttons[i].x - buttons[i].w / 2;
buttonsAutoFireRect[i].y = buttons[i].y - buttons[i].h / 2;
}
for( i = 0; i < MAX_BUTTONS; i++ )
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Settings_nativeSetupScreenKeyboard() 2: button %d pos %d %d %d %d", i, (int)buttons[i].x, (int)buttons[i].y, (int)buttons[i].w, (int)buttons[i].h);
};


Expand Down Expand Up @@ -855,6 +859,7 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
if( buttonId == SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD )
{
arrows = *pos;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SetScreenKeyboardButtonPos(): arrows %dx%d-%dx%d", (int)pos->x, (int)pos->y, (int)pos->w, (int)pos->h);
if(touchscreenKeyboardTheme == 0)
{
prepareFontCharWireframe(FONT_LEFT, arrows.w / 2, arrows.h / 2);
Expand All @@ -866,6 +871,7 @@ int SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos)
else
{
buttons[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = *pos;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SetScreenKeyboardButtonPos(): button %d %dx%d-%dx%d", buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, (int)pos->x, (int)pos->y, (int)pos->w, (int)pos->h);
if(touchscreenKeyboardTheme == 0)
{
int i = buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0;
Expand Down Expand Up @@ -895,6 +901,7 @@ int SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, SDLKey key)
{
if( buttonId < SDL_ANDROID_SCREENKEYBOARD_BUTTON_0 || buttonId > SDL_ANDROID_SCREENKEYBOARD_BUTTON_5 || ! key )
return 0;
__android_log_print(ANDROID_LOG_INFO, "libSDL", "SetScreenKeyboardButtonKey(): %d %d", buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, key);
buttonKeysyms[buttonId - SDL_ANDROID_SCREENKEYBOARD_BUTTON_0] = key;
return 1;
};
Expand Down

0 comments on commit e34e40f

Please sign in to comment.