Cleaned up mouse events implementation - should fix problems with double-clicking with left-click emulation set to "normal"

This commit is contained in:
pelya
2011-02-14 15:16:56 +00:00
parent 1e468ea75d
commit 29a7cff034
5 changed files with 13 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2
APP_MODULES := application sdl-1.2 sdl_main stlport jpeg png ogg flac vorbis freetype tremor ogg
# To filter out static libs from all libs in makefile

View File

@@ -21,6 +21,6 @@ ln -sf libtremor.a $LOCAL_PATH/../../../obj/local/armeabi/libvorbisidec.a
ln -sf libflac.a $LOCAL_PATH/../../../obj/local/armeabi/libFLAC.a
if [ \! -f scummvm/config.mk ] ; then
../setEnvironment.sh sh -c "cd scummvm && env LIBS='-lflac -ltremor -logg -lmad -lz -lgcc -lfluidsynth' ./configure --host=androidsdl --enable-zlib --enable-tremor --enable-mad --enable-flac --enable-vkeybd --enable-verbose-build --disable-hq-scalers --disable-readline --disable-nasm --disable-mt32emu --datadir=. --with-fluidsynth-prefix=$LOCAL_PATH/../../fluidsynth"
../setEnvironment.sh sh -c "cd scummvm && env LIBS='-lflac -ltremor -logg -lmad -lz -lgcc -lfluidsynth -lstdc++' ./configure --host=androidsdl --enable-zlib --enable-tremor --enable-mad --enable-flac --enable-vkeybd --enable-verbose-build --disable-hq-scalers --disable-readline --disable-nasm --disable-mt32emu --datadir=. --with-fluidsynth-prefix=$LOCAL_PATH/../../fluidsynth"
fi
../setEnvironment.sh make -C scummvm -j2 && cp -f scummvm/scummvm libapplication.so

View File

@@ -9,7 +9,7 @@ Index: configure
+androidsdl)
+ _host_os=androidsdl
+ _host_cpu=arm
+ _host_alias=arm-linux-androideabi
+ _host_alias=arm-eabi
+ ;;
arm-riscos)
_host_os=riscos

View File

@@ -1 +1 @@
alienblaster
ballfield

View File

@@ -115,6 +115,7 @@ int relativeMovementY = 0;
unsigned int relativeMovementTime = 0;
int oldMouseX = 0;
int oldMouseY = 0;
int oldMouseButtons = 0;
static inline int InsideRect(const SDL_Rect * r, int x, int y)
{
@@ -510,10 +511,9 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
{
int button = (leftClickMethod == LEFT_CLICK_WITH_PRESSURE) ? SDL_BUTTON_LEFT : SDL_BUTTON_RIGHT;
int buttonState = ( force > maxForce || radius > maxRadius );
if( button == SDL_BUTTON_RIGHT && (SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON(SDL_BUTTON_LEFT)) )
if( button == SDL_BUTTON_RIGHT )
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_LEFT );
if( ( (SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON(button)) != 0 ) != buttonState )
SDL_ANDROID_MainThreadPushMouseButton( buttonState ? SDL_PRESSED : SDL_RELEASED, button );
SDL_ANDROID_MainThreadPushMouseButton( buttonState ? SDL_PRESSED : SDL_RELEASED, button );
}
if( mouseInitialX >= 0 && mouseInitialY >= 0 && (
leftClickMethod == LEFT_CLICK_WITH_TIMEOUT || leftClickMethod == LEFT_CLICK_WITH_TAP ||
@@ -559,8 +559,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
}
else if( rightClickMethod == RIGHT_CLICK_WITH_MULTITOUCH )
{
if( SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON(SDL_BUTTON_LEFT) )
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_LEFT );
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_LEFT );
SDL_ANDROID_MainThreadPushMouseButton( (action == MOUSE_DOWN) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT );
}
}
@@ -1155,7 +1154,11 @@ extern void SDL_ANDROID_PumpEvents()
SDL_SendMouseMotion(NULL, 0, ev->motion.x, ev->motion.y);
break;
case SDL_MOUSEBUTTONDOWN:
SDL_SendMouseButton( NULL, ev->button.state, ev->button.button );
if( ((oldMouseButtons & SDL_BUTTON(ev->button.button)) != 0) != ev->button.state )
{
oldMouseButtons = (oldMouseButtons & ~SDL_BUTTON(ev->button.button)) | (ev->button.state ? SDL_BUTTON(ev->button.button) : 0);
SDL_SendMouseButton( NULL, ev->button.state, ev->button.button );
}
break;
case SDL_KEYDOWN:
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_KEYDOWN: %i %i", ev->key.keysym.sym, ev->key.state);