Fixed the NO_REMAP implementation, fixed few minor bg in Settings.java

This commit is contained in:
pelya
2011-05-30 15:25:08 +03:00
parent f06e5643e7
commit b10fefba4f
9 changed files with 31 additions and 72 deletions

View File

@@ -652,29 +652,34 @@ void SDL_ANDROID_WarpMouse(int x, int y)
static int processAndroidTrackball(int key, int action);
JNIEXPORT void JNICALL
JNIEXPORT jint JNICALL
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action )
{
#if SDL_VERSION_ATLEAST(1,3,0)
#else
if( !SDL_CurrentVideoSurface )
return;
return 1;
#endif
if( isTrackballUsed )
if( processAndroidTrackball(key, action) )
return;
return 1;
if( key == rightClickKey && rightClickMethod == RIGHT_CLICK_WITH_KEY )
{
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT );
return;
return 1;
}
if( (key == leftClickKey && leftClickMethod == LEFT_CLICK_WITH_KEY) || (clickMouseWithDpadCenter && key == KEYCODE_DPAD_CENTER) )
{
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT );
return;
return 1;
}
if( TranslateKey(key) == SDLK_NO_REMAP )
return 0;
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, TranslateKey(key) );
return 1;
}
static char * textInputBuffer = NULL;
@@ -762,6 +767,7 @@ static int getClickTimeout(int v)
return 1000;
}
// Mwahaha overkill!
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) ( JNIEnv* env, jobject thiz,
jint RightClickMethod, jint ShowScreenUnderFinger, jint LeftClickMethod,
@@ -1331,7 +1337,6 @@ extern void SDL_ANDROID_MainThreadPushKeyboardKey(int pressed, SDL_scancode key)
SDL_Event * ev = &BufferedEvents[BufferedEventsEnd];
if( moveMouseWithArrowKeys && (
key == SDL_KEY(UP) || key == SDL_KEY(DOWN) ||
key == SDL_KEY(LEFT) || key == SDL_KEY(RIGHT) ) )

View File

@@ -52,6 +52,9 @@
/* JNI-C++ wrapper stuff */
// Special key to signal that key should be handled by Java internally, such as Volume Up/Down keys
#define SDLK_NO_REMAP 512
#if SDL_VERSION_ATLEAST(1,3,0)
#define SDL_KEY2(X) SDL_SCANCODE_ ## X

View File

@@ -97,7 +97,7 @@ KEYCODE_MEDIA_REWIND = 89,
KEYCODE_MEDIA_FAST_FORWARD = 90,
KEYCODE_MUTE = 91,
KEYCODE_LAST = 110 // Android 2.3 added several new gaming keys, it ends up at keycode 110 currently - plz keep in sync with Keycodes.java
KEYCODE_LAST = 255 // Android 2.3 added several new gaming keys, Android 3.1 added even more - plz keep in sync with Keycodes.java
};
#endif