SDL: SDL_WarpMouse() will move cursor coordinates for captured mouse on Android O
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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/
|
||||
|
||||
Submodule project/jni/application/xserver/xserver updated: 62db8acad2...2d7b63a920
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user