From 5132ae8020b0cfbc4f60b317660e1782904a9f08 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Wed, 21 Jun 2017 17:51:40 +0300 Subject: [PATCH] SDL: center mouse cursor between ouch points when sending pinch-zoom gesture keycode --- project/jni/sdl-1.2/src/video/android/SDL_androidinput.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c b/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c index 056183910..264ae5757 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidinput.c @@ -349,13 +349,14 @@ static void ProcessMultitouchGesture( int x, int y, int action, int pointerId ) } else { - int distMaxDiff = SDL_ANDROID_sFakeWindowHeight / ( 1 + (1 + multitouchGestureSensitivity) * 2 ); + int distMaxDiff = SDL_ANDROID_sFakeWindowHeight / ( 2 + (1 + multitouchGestureSensitivity) * 3 ); int angleMaxDiff = atan2i_PI * 2 / 3 / ( 1 + (1 + multitouchGestureSensitivity) * 2 ); int wheelThreshold = SDL_ANDROID_sFakeWindowHeight / MULTITOUCH_MOUSE_WHEEL_DIST; if( dist - multitouchGestureDist > distMaxDiff ) { multitouchGestureHappened = 1; multitouchGestureDist += distMaxDiff; + SDL_ANDROID_MainThreadPushMouseMotion( middleX, middleY ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, multitouchGestureKeycode[0], 0 ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, multitouchGestureKeycode[0], 0 ); } @@ -363,6 +364,7 @@ static void ProcessMultitouchGesture( int x, int y, int action, int pointerId ) { multitouchGestureHappened = 1; multitouchGestureDist -= distMaxDiff; + SDL_ANDROID_MainThreadPushMouseMotion( middleX, middleY ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, multitouchGestureKeycode[1], 0 ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, multitouchGestureKeycode[1], 0 ); } @@ -378,6 +380,7 @@ static void ProcessMultitouchGesture( int x, int y, int action, int pointerId ) { multitouchGestureHappened = 1; multitouchGestureAngle = angle; + SDL_ANDROID_MainThreadPushMouseMotion( middleX, middleY ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, multitouchGestureKeycode[2], 0 ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, multitouchGestureKeycode[2], 0 ); } @@ -385,6 +388,7 @@ static void ProcessMultitouchGesture( int x, int y, int action, int pointerId ) { multitouchGestureHappened = 1; multitouchGestureAngle = angle; + SDL_ANDROID_MainThreadPushMouseMotion( middleX, middleY ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, multitouchGestureKeycode[3], 0 ); SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, multitouchGestureKeycode[3], 0 ); }