diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 2a239590f..af69ce0da 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -806,12 +806,6 @@ echo >> AndroidAppSettings.cfg echo "# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape" >> AndroidAppSettings.cfg echo ScreenOrientation=$ScreenOrientation >> AndroidAppSettings.cfg echo >> AndroidAppSettings.cfg -echo "# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer" >> AndroidAppSettings.cfg -echo InhibitSuspend=$InhibitSuspend >> AndroidAppSettings.cfg -echo >> AndroidAppSettings.cfg -echo "# Create Android service, so the app is less likely to be killed while in background" >> AndroidAppSettings.cfg -echo CreateService=$CreateService >> AndroidAppSettings.cfg -echo >> AndroidAppSettings.cfg echo "# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only" >> AndroidAppSettings.cfg echo "# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)" >> AndroidAppSettings.cfg echo VideoDepthBpp=$VideoDepthBpp >> AndroidAppSettings.cfg @@ -836,6 +830,12 @@ echo >> AndroidAppSettings.cfg echo "# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)" >> AndroidAppSettings.cfg echo SdlVideoResizeKeepAspect=$SdlVideoResizeKeepAspect >> AndroidAppSettings.cfg echo >> AndroidAppSettings.cfg +echo "# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer" >> AndroidAppSettings.cfg +echo InhibitSuspend=$InhibitSuspend >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg +echo "# Create Android service, so the app is less likely to be killed while in background" >> AndroidAppSettings.cfg +echo CreateService=$CreateService >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg echo "# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread -" >> AndroidAppSettings.cfg echo "# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n)" >> AndroidAppSettings.cfg echo CompatibilityHacks=$CompatibilityHacks >> AndroidAppSettings.cfg @@ -872,6 +872,10 @@ echo >> AndroidAppSettings.cfg echo "# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)" >> AndroidAppSettings.cfg echo AppNeedsTwoButtonMouse=$AppNeedsTwoButtonMouse >> AndroidAppSettings.cfg echo >> AndroidAppSettings.cfg +echo "# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)" >> AndroidAppSettings.cfg +echo "# If you disable it, swiping with two fingers will send mouse wheel events" >> AndroidAppSettings.cfg +echo RightMouseButtonLongPress=$RightMouseButtonLongPress >> AndroidAppSettings.cfg +echo >> AndroidAppSettings.cfg echo "# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)" >> AndroidAppSettings.cfg echo ShowMouseCursor=$ShowMouseCursor >> AndroidAppSettings.cfg echo >> AndroidAppSettings.cfg @@ -1145,6 +1149,12 @@ else AppNeedsTwoButtonMouse=false fi +if [ "$RightMouseButtonLongPress" = "n" ] ; then + RightMouseButtonLongPress=false +else + RightMouseButtonLongPress=true +fi + if [ "$ForceRelativeMouseMode" = "y" ] ; then ForceRelativeMouseMode=true else @@ -1386,6 +1396,7 @@ $SEDI "s/public static boolean InhibitSuspend = .*;/public static boolean Inhibi $SEDI "s/public static boolean CreateService = .*;/public static boolean CreateService = $CreateService;/" project/src/Globals.java $SEDI "s/public static boolean AppUsesMouse = .*;/public static boolean AppUsesMouse = $AppUsesMouse;/" project/src/Globals.java $SEDI "s/public static boolean AppNeedsTwoButtonMouse = .*;/public static boolean AppNeedsTwoButtonMouse = $AppNeedsTwoButtonMouse;/" project/src/Globals.java +$SEDI "s/public static boolean RightMouseButtonLongPress = .*;/public static boolean RightMouseButtonLongPress = $RightMouseButtonLongPress;/" project/src/Globals.java $SEDI "s/public static boolean ForceRelativeMouseMode = .*;/public static boolean ForceRelativeMouseMode = $ForceRelativeMouseMode;/" project/src/Globals.java $SEDI "s/public static boolean ShowMouseCursor = .*;/public static boolean ShowMouseCursor = $ShowMouseCursor;/" project/src/Globals.java $SEDI "s/public static boolean GenerateSubframeTouchEvents = .*;/public static boolean GenerateSubframeTouchEvents = $GenerateSubframeTouchEvents;/" project/src/Globals.java diff --git a/project/java/Globals.java b/project/java/Globals.java index 05c8f035e..e98f53f60 100644 --- a/project/java/Globals.java +++ b/project/java/Globals.java @@ -51,6 +51,7 @@ class Globals public static String CommandLine = ""; public static boolean AppUsesMouse = false; public static boolean AppNeedsTwoButtonMouse = false; + public static boolean RightMouseButtonLongPress = true; public static boolean ForceRelativeMouseMode = false; // If both on-screen keyboard and mouse are needed, this will only set the default setting, user may override it later public static boolean ShowMouseCursor = false; public static boolean GenerateSubframeTouchEvents = false; diff --git a/project/java/Settings.java b/project/java/Settings.java index b88829df3..7158492be 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -498,7 +498,8 @@ class Settings Globals.RelativeMouseMovementSpeed, Globals.RelativeMouseMovementAccel, Globals.ShowMouseCursor ? 1 : 0, - Globals.HoverJitterFilter ? 1 : 0); + Globals.HoverJitterFilter ? 1 : 0, + Globals.RightMouseButtonLongPress ? 1 : 0); } static void Apply(MainActivity p) @@ -768,7 +769,7 @@ class Settings int leftClickTimeout, int rightClickTimeout, int relativeMovement, int relativeMovementSpeed, int relativeMovementAccel, int showMouseCursor, - int HoverJitterFilter); + int HoverJitterFilter, int RightMouseButtonLongPress); private static native void nativeSetJoystickUsed(int firstJoystickUsed, int secondJoystickUsed); private static native void nativeSetAccelerometerUsed(); private static native void nativeSetMultitouchUsed(); diff --git a/project/jni/application/xserver-gimp/AndroidAppSettings.cfg b/project/jni/application/xserver-gimp/AndroidAppSettings.cfg index 15f11bc2b..db679b552 100644 --- a/project/jni/application/xserver-gimp/AndroidAppSettings.cfg +++ b/project/jni/application/xserver-gimp/AndroidAppSettings.cfg @@ -241,3 +241,6 @@ AdmobTestDeviceId= # Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) AdmobBannerSize= +# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n) +# If you disable it, swiping with two fingers will send mouse wheel events +RightMouseButtonLongPress=n diff --git a/project/jni/application/xserver/AndroidAppSettings.cfg b/project/jni/application/xserver/AndroidAppSettings.cfg index 7c612b9bc..5f1cfbf83 100644 --- a/project/jni/application/xserver/AndroidAppSettings.cfg +++ b/project/jni/application/xserver/AndroidAppSettings.cfg @@ -36,12 +36,6 @@ LibSdlVersion=1.2 # Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape ScreenOrientation=h -# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer -InhibitSuspend=n - -# Create Android service, so the app is less likely to be killed while in background -CreateService=y - # Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only # with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) VideoDepthBpp=16 @@ -66,6 +60,12 @@ SdlVideoResize=y # Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) SdlVideoResizeKeepAspect=n +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer +InhibitSuspend=n + +# Create Android service, so the app is less likely to be killed while in background +CreateService=y + # Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - # enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) CompatibilityHacks=n @@ -102,6 +102,10 @@ AppUsesMouse=y # Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) AppNeedsTwoButtonMouse=y +# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n) +# If you disable it, swiping with two fingers will send mouse wheel events +RightMouseButtonLongPress=n + # Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) ShowMouseCursor=n diff --git a/project/jni/application/xserver/xserver b/project/jni/application/xserver/xserver index b24094aa9..4efefed24 160000 --- a/project/jni/application/xserver/xserver +++ b/project/jni/application/xserver/xserver @@ -1 +1 @@ -Subproject commit b24094aa9cf1d923109a814a257a9530eed778b2 +Subproject commit 4efefed243076833d0fe44f4587f0e2cd7f4db6a 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 f41b59ccc..deb18af89 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 @@ -133,6 +133,7 @@ enum { MOUSE_HW_INPUT_FINGER = 0, MOUSE_HW_INPUT_STYLUS = 1, MOUSE_HW_INPUT_MOUS enum { DEADZONE_HOVER_FINGER = 32, DEADZONE_HOVER_STYLUS = 64, HOVER_FREEZE_TIME = 300, HOVER_DISTANCE_MAX = 1024 }; static int hoverJitterFilter = 1; static int hoverX, hoverY, hoverTime = 0, hoverMouseFreeze = 0, hoverDeadzone = 0; +static int rightMouseButtonLongPress = 1; static inline int InsideRect( const SDL_Rect * r, int x, int y ) { @@ -358,6 +359,9 @@ static void ProcessMultitouchGesture( int x, int y, int action, int pointerId ) SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, multitouchGestureKeycode[3], 0 ); } + if( rightMouseButtonLongPress ) + return; + //__android_log_print(ANDROID_LOG_INFO, "libSDL", "middleY %d multitouchGestureMiddleY %d threshold %d", middleY, multitouchGestureMiddleY, wheelThreshold); if( middleX - multitouchGestureMiddleX > wheelThreshold ) { @@ -643,12 +647,17 @@ static void ProcessMouseMultitouch( int action, int pointerId ) else if( rightClickMethod == RIGHT_CLICK_WITH_MULTITOUCH ) { SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_LEFT ); - if( action == MOUSE_UP ) + if( rightMouseButtonLongPress ) + SDL_ANDROID_MainThreadPushMouseButton( (action == MOUSE_DOWN) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT ); + else { - if( !multitouchGestureHappened ) + if( action == MOUSE_UP ) { - SDL_ANDROID_MainThreadPushMouseButton( SDL_PRESSED, SDL_BUTTON_RIGHT ); - SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_RIGHT ); + if( !multitouchGestureHappened ) + { + SDL_ANDROID_MainThreadPushMouseButton( SDL_PRESSED, SDL_BUTTON_RIGHT ); + SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_RIGHT ); + } } multitouchGestureHappened = 0; } @@ -952,7 +961,7 @@ JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) (JNIEnv* env, jobject thiz, jint LeftClickKeycode, jint RightClickKeycode, jint LeftClickTimeout, jint RightClickTimeout, jint RelativeMovement, jint RelativeMovementSpeed, jint RelativeMovementAccel, - jint ShowMouseCursor, jint HoverJitterFilter) + jint ShowMouseCursor, jint HoverJitterFilter, jint RightMouseButtonLongPress) { SDL_ANDROID_isMouseUsed = 1; rightClickMethod = RightClickMethod; @@ -973,6 +982,7 @@ JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) (JNIEnv* env, jobject thiz, relativeMovementAccel = RelativeMovementAccel; SDL_ANDROID_ShowMouseCursor = ShowMouseCursor; hoverJitterFilter = HoverJitterFilter; + rightMouseButtonLongPress = RightMouseButtonLongPress; //__android_log_print(ANDROID_LOG_INFO, "libSDL", "relativeMovementSpeed %d relativeMovementAccel %d", relativeMovementSpeed, relativeMovementAccel); }