diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index f7b3d1b82..88dc639b4 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -1427,12 +1427,13 @@ public class MainActivity extends Activity } } - public void setSystemMousePointerVisible(int visible) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) + public void setSystemMousePointerVisible(int visible) + { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { mGLView.setPointerIcon(android.view.PointerIcon.getSystemIcon(this, (visible == 0) ? android.view.PointerIcon.TYPE_NULL : android.view.PointerIcon.TYPE_DEFAULT)); } - } + } public FrameLayout getVideoLayout() { return _videoLayout; } diff --git a/project/java/Video.java b/project/java/Video.java index 8c27ec4c1..6439c8c57 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -884,6 +884,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer Clipboard.get().set(context, s); } + public void setCapturedMousePosition(int x, int y) // Called from native code + { + DifferentTouchInput.capturedMouseX = x; + DifferentTouchInput.capturedMouseY = y; + } + public void exitApp() { nativeDone(); diff --git a/project/jni/application/xserver/AndroidAppSettings.cfg b/project/jni/application/xserver/AndroidAppSettings.cfg index e4e3a2f4c..ea170ece1 100644 --- a/project/jni/application/xserver/AndroidAppSettings.cfg +++ b/project/jni/application/xserver/AndroidAppSettings.cfg @@ -7,10 +7,10 @@ AppName="XServer XSDL" AppFullName=x.org.server # Application version code (integer) -AppVersionCode=12044 # Because Google Play already has test release with this version number +AppVersionCode=12048 # Application user-visible version name (string) -AppVersionName="1.20.44" +AppVersionName="1.20.48" # Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' # If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled @@ -26,7 +26,7 @@ AppDataDownloadUrl="!!Library mapping|bin-map.zip^!!Data files|:data.tar.gz:data ResetSdlConfigForThisVersion=n # Delete application data files when upgrading (specify file/dir paths separated by spaces) -DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag busybox usr tmp pulseaudio.conf" +DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag libsdl-DownloadFinished-1.flag busybox usr tmp pulseaudio.conf" # Here you may type readme text, which will be shown during startup. Format is: # Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/ diff --git a/project/jni/application/xserver/xserver b/project/jni/application/xserver/xserver index 62db8acad..2d7b63a92 160000 --- a/project/jni/application/xserver/xserver +++ b/project/jni/application/xserver/xserver @@ -1 +1 @@ -Subproject commit 62db8acad2b14d7e135cabe727c59ee8744a145d +Subproject commit 2d7b63a920ae5a0aba7e245e96fe8957e2c1abd7 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 7088a58d6..768787988 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 @@ -967,6 +967,10 @@ static void ProcessMoveMouseWithGyroscope(float gx, float gy, float gz) void SDL_ANDROID_WarpMouse(int x, int y) { //__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_ANDROID_WarpMouse(): %dx%d rel %dx%d old %dx%d", x, y, relativeMovementX, relativeMovementY, SDL_ANDROID_currentMouseX, SDL_ANDROID_currentMouseY); + if( hardwareMouseDetected ) + { + SDL_ANDROID_SetCapturedMousePosition(x, y); + } relativeMovementX -= SDL_ANDROID_currentMouseX-x; relativeMovementY -= SDL_ANDROID_currentMouseY-y; SDL_ANDROID_MainThreadPushMouseMotion(x, y); diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c index ccd7ea632..56dd776fa 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c @@ -90,6 +90,7 @@ static jmethodID JavaRequestOpenExternalApp = NULL; static jmethodID JavaRequestRestartMyself = NULL; static jmethodID JavaRequestSetConfigOption = NULL; static jmethodID JavaSetSystemMousePointerVisible = NULL; +static jmethodID JavaSetCapturedMousePosition = NULL; static int glContextLost = 0; static int showScreenKeyboardDeferred = 0; static const char * showScreenKeyboardOldText = ""; @@ -397,6 +398,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject t JavaRequestRestartMyself = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "restartMyself", "(Ljava/lang/String;)V"); JavaRequestSetConfigOption = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setConfigOptionFromSDL", "(II)V"); JavaSetSystemMousePointerVisible = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setSystemMousePointerVisible", "(I)V"); + JavaSetCapturedMousePosition = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setCapturedMousePosition", "(II)V"); ANDROID_InitOSKeymap(); } @@ -664,6 +666,12 @@ void SDLCALL SDL_ANDROID_SetSystemMousePointerVisible(int visible) (*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaSetSystemMousePointerVisible, (jint)visible ); } +void SDLCALL SDL_ANDROID_SetCapturedMousePosition(int x, int y) +{ + JNIEnv *JavaEnv = GetJavaEnv(); + (*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaSetCapturedMousePosition, (jint)x, (jint)y ); +} + // Dummy callback for SDL2 to satisfy linker extern void SDL_Android_Init(JNIEnv* env, jclass cls); void SDL_Android_Init(JNIEnv* env, jclass cls) diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h index 5586ad534..626e7aaf9 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h @@ -81,6 +81,7 @@ extern void SDL_ANDROID_initFakeStdout(); extern SDL_VideoDevice *ANDROID_CreateDevice_1_3(int devindex); extern void SDL_ANDROID_ProcessDeferredEvents(); extern void SDL_ANDROID_WarpMouse(int x, int y); +extern void SDL_ANDROID_SetCapturedMousePosition(int x, int y); extern void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, float alpha); extern void SDL_ANDROID_DrawMouseCursorIfNeeded(); extern void SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput();