Right mouse button long-press is not an option in AndoridAppSettings.cfg

This commit is contained in:
Sergii Pylypenko
2014-02-25 17:29:40 +02:00
parent a599c8ddc7
commit 700a1d88c7
7 changed files with 50 additions and 20 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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();

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}