diff --git a/project/java/Globals.java b/project/java/Globals.java
index b0c85eae8..c067a950b 100644
--- a/project/java/Globals.java
+++ b/project/java/Globals.java
@@ -59,13 +59,18 @@ class Globals {
public static int TrackballDampening = 0;
public static int AudioBufferConfig = 0;
public static boolean OptionalDataDownload[] = null;
+ public static final int LEFT_CLICK_NORMAL = 0;
+ public static final int LEFT_CLICK_NEAR_CURSOR = 1;
+ public static final int LEFT_CLICK_WITH_MULTITOUCH = 2;
+ public static final int LEFT_CLICK_WITH_PRESSURE = 3;
+ public static final int LEFT_CLICK_WITH_DPAD_CENTER = 4;
+ public static int LeftClickMethod = LEFT_CLICK_NORMAL;
public static final int RIGHT_CLICK_NONE = 0;
- public static final int RIGHT_CLICK_WITH_MENU_BUTTON = 1;
- public static final int RIGHT_CLICK_WITH_MULTITOUCH = 2;
- public static final int RIGHT_CLICK_WITH_PRESSURE = 3;
+ public static final int RIGHT_CLICK_WITH_MULTITOUCH = 1;
+ public static final int RIGHT_CLICK_WITH_PRESSURE = 2;
+ public static final int RIGHT_CLICK_WITH_MENU_BUTTON = 3;
public static int RightClickMethod = RIGHT_CLICK_NONE;
- public static boolean LeftClickUsesPressure = false;
- public static boolean LeftClickUsesMultitouch = false;
+ public static boolean MoveMouseWithJoystick = false;
public static boolean ShowScreenUnderFinger = false;
public static boolean KeepAspectRatio = false;
public static int ClickScreenPressure = 0;
diff --git a/project/java/Settings.java b/project/java/Settings.java
index bd3627242..91c633fc0 100644
--- a/project/java/Settings.java
+++ b/project/java/Settings.java
@@ -51,8 +51,8 @@ class Settings
out.writeInt(Globals.TouchscreenKeyboardTheme);
out.writeInt(Globals.RightClickMethod);
out.writeBoolean(Globals.ShowScreenUnderFinger);
- out.writeBoolean(Globals.LeftClickUsesPressure);
- out.writeBoolean(Globals.LeftClickUsesMultitouch);
+ out.writeInt(Globals.LeftClickMethod);
+ out.writeBoolean(Globals.MoveMouseWithJoystick);
out.writeInt(Globals.ClickScreenPressure);
out.writeInt(Globals.ClickScreenTouchspotSize);
out.writeBoolean(Globals.KeepAspectRatio);
@@ -90,8 +90,8 @@ class Settings
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
Globals.RightClickMethod = settingsFile.readInt();
Globals.ShowScreenUnderFinger = settingsFile.readBoolean();
- Globals.LeftClickUsesPressure = settingsFile.readBoolean();
- Globals.LeftClickUsesMultitouch = settingsFile.readBoolean();
+ Globals.LeftClickMethod = settingsFile.readInt();
+ Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
Globals.ClickScreenPressure = settingsFile.readInt();
Globals.ClickScreenTouchspotSize = settingsFile.readInt();
Globals.KeepAspectRatio = settingsFile.readBoolean();
@@ -175,7 +175,7 @@ class Settings
{
Globals.OptionalDataDownload = new boolean[1];
Globals.OptionalDataDownload[0] = true;
- showKeyboardConfig(p);
+ showAdditionalInputConfig(p);
return;
}
@@ -205,7 +205,7 @@ class Settings
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
- showKeyboardConfig(p);
+ showAdditionalInputConfig(p);
}
});
@@ -213,87 +213,24 @@ class Settings
alert.setOwnerActivity(p);
alert.show();
};
-
- static void showKeyboardConfig(final MainActivity p)
- {
- if( ! Globals.AppNeedsArrowKeys )
- {
- Globals.PhoneHasArrowKeys = false;
- Globals.PhoneHasTrackball = false;
- showTrackballConfig(p);
- return;
- }
-
- final CharSequence[] items = { p.getResources().getString(R.string.controls_arrows),
- p.getResources().getString(R.string.controls_trackball),
- p.getResources().getString(R.string.controls_touch) };
-
- AlertDialog.Builder builder = new AlertDialog.Builder(p);
- builder.setTitle(p.getResources().getString(R.string.controls_question));
- builder.setSingleChoiceItems(items, Globals.PhoneHasArrowKeys ? 0 : ( Globals.PhoneHasTrackball ? 1 : 2 ), new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int item)
- {
- Globals.PhoneHasArrowKeys = (item == 0);
- Globals.PhoneHasTrackball = (item == 1);
-
- dialog.dismiss();
- showTrackballConfig(p);
- }
- });
- AlertDialog alert = builder.create();
- alert.setOwnerActivity(p);
- alert.show();
- }
-
- static void showTrackballConfig(final MainActivity p)
- {
- if( ! Globals.PhoneHasTrackball )
- {
- Globals.TrackballDampening = 0;
- showAdditionalInputConfig(p);
- return;
- }
-
- final CharSequence[] items = { p.getResources().getString(R.string.trackball_no_dampening),
- p.getResources().getString(R.string.trackball_fast),
- p.getResources().getString(R.string.trackball_medium),
- p.getResources().getString(R.string.trackball_slow) };
-
- AlertDialog.Builder builder = new AlertDialog.Builder(p);
- builder.setTitle(p.getResources().getString(R.string.trackball_question));
- builder.setSingleChoiceItems(items, Globals.TrackballDampening, new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int item)
- {
- Globals.TrackballDampening = item;
-
- dialog.dismiss();
- showAdditionalInputConfig(p);
- }
- });
- AlertDialog alert = builder.create();
- alert.setOwnerActivity(p);
- alert.show();
- }
-
static void showAdditionalInputConfig(final MainActivity p)
{
-
- if( ! ( Globals.AppNeedsArrowKeys || Globals.AppNeedsTextInput || Globals.AppTouchscreenKeyboardKeysAmount > 0 ) && ! Globals.AppUsesJoystick )
- {
- Globals.UseTouchscreenKeyboard = false;
- Globals.UseAccelerometerAsArrowKeys = false;
- showAccelerometerConfig(p);
- return;
- }
final CharSequence[] items = {
p.getResources().getString(R.string.controls_screenkb),
p.getResources().getString(R.string.controls_accelnav),
+ p.getResources().getString(R.string.pointandclick_keepaspectratio),
+ p.getResources().getString(R.string.pointandclick_showcreenunderfinger),
+ p.getResources().getString(R.string.pointandclick_joystickmouse)
};
- final boolean defaults[] = { Globals.UseTouchscreenKeyboard, Globals.UseAccelerometerAsArrowKeys };
+ final boolean defaults[] = {
+ Globals.UseTouchscreenKeyboard,
+ Globals.UseAccelerometerAsArrowKeys,
+ Globals.KeepAspectRatio,
+ Globals.ShowScreenUnderFinger,
+ Globals.MoveMouseWithJoystick
+ };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.controls_additional));
@@ -305,6 +242,12 @@ class Settings
Globals.UseTouchscreenKeyboard = isChecked;
if( item == 1 )
Globals.UseAccelerometerAsArrowKeys = isChecked;
+ if( item == 2 )
+ Globals.KeepAspectRatio = isChecked;
+ if( item == 3 )
+ Globals.ShowScreenUnderFinger = isChecked;
+ if( item == 4 )
+ Globals.MoveMouseWithJoystick = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
@@ -315,6 +258,14 @@ class Settings
showAccelerometerConfig(p);
}
});
+ builder.setNegativeButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int item)
+ {
+ dialog.dismiss();
+ showAccelerometerConfig(p);
+ }
+ });
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
@@ -462,7 +413,7 @@ class Settings
{
Globals.AudioBufferConfig = item;
dialog.dismiss();
- showRightClickConfigConfig(p);
+ showLeftClickConfig(p);
}
});
AlertDialog alert = builder.create();
@@ -470,27 +421,58 @@ class Settings
alert.show();
}
- static void showRightClickConfigConfig(final MainActivity p)
+ static void showLeftClickConfig(final MainActivity p)
+ {
+ if( ! Globals.AppUsesMouse )
+ {
+ Globals.LeftClickMethod = Globals.LEFT_CLICK_NORMAL;
+ showRightClickConfig(p);
+ return;
+ }
+ final CharSequence[] items = { p.getResources().getString(R.string.leftclick_normal),
+ p.getResources().getString(R.string.leftclick_near_cursor),
+ p.getResources().getString(R.string.leftclick_multitouch),
+ p.getResources().getString(R.string.leftclick_pressure),
+ p.getResources().getString(R.string.leftclick_dpadcenter) };
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(p);
+ builder.setTitle(R.string.leftclick_question);
+ builder.setSingleChoiceItems(items, Globals.LeftClickMethod, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int item)
+ {
+ Globals.LeftClickMethod = item;
+ dialog.dismiss();
+ showRightClickConfig(p);
+ }
+ });
+ AlertDialog alert = builder.create();
+ alert.setOwnerActivity(p);
+ alert.show();
+ }
+
+ static void showRightClickConfig(final MainActivity p)
{
if( ! Globals.AppNeedsTwoButtonMouse )
{
Globals.RightClickMethod = Globals.RIGHT_CLICK_NONE;
- showAdvancedPointAndClickConfigConfig(p);
+ showKeyboardConfig(p);
return;
}
- final CharSequence[] items = { p.getResources().getString(R.string.rightclick_menu),
+ final CharSequence[] items = { p.getResources().getString(R.string.rightclick_none),
p.getResources().getString(R.string.rightclick_multitouch),
- p.getResources().getString(R.string.rightclick_pressure) };
+ p.getResources().getString(R.string.rightclick_pressure),
+ p.getResources().getString(R.string.rightclick_menu) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.rightclick_question);
- builder.setSingleChoiceItems(items, Globals.RightClickMethod-1, new DialogInterface.OnClickListener()
+ builder.setSingleChoiceItems(items, Globals.RightClickMethod, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
- Globals.RightClickMethod = item + 1;
+ Globals.RightClickMethod = item;
dialog.dismiss();
- showAdvancedPointAndClickConfigConfig(p);
+ showKeyboardConfig(p);
}
});
AlertDialog alert = builder.create();
@@ -498,87 +480,83 @@ class Settings
alert.show();
}
- static void showAdvancedPointAndClickConfigConfig(final MainActivity p)
+ static void showKeyboardConfig(final MainActivity p)
{
-
- /*
- if( ! Globals.AppNeedsTwoButtonMouse )
+ if( ! Globals.AppNeedsArrowKeys && ! Globals.MoveMouseWithJoystick )
{
- showTouchPressureMeasurementTool(p);
+ Globals.PhoneHasArrowKeys = false;
+ Globals.PhoneHasTrackball = false;
+ showTrackballConfig(p);
return;
}
- */
- CharSequence[] items = { p.getResources().getString(R.string.pointandclick_keepaspectratio),
- p.getResources().getString(R.string.pointandclick_showcreenunderfinger),
- p.getResources().getString(R.string.pointandclick_usepressure),
- p.getResources().getString(R.string.pointandclick_multitouch) };
- boolean defaults[] = { Globals.KeepAspectRatio, Globals.ShowScreenUnderFinger, Globals.LeftClickUsesPressure, Globals.LeftClickUsesMultitouch };
- if( Globals.RightClickMethod == Globals.RIGHT_CLICK_WITH_PRESSURE )
- {
- Globals.LeftClickUsesPressure = false;
- CharSequence[] items2 = { p.getResources().getString(R.string.pointandclick_keepaspectratio),
- p.getResources().getString(R.string.pointandclick_showcreenunderfinger),
- p.getResources().getString(R.string.pointandclick_multitouch) };
- boolean defaults2[] = { Globals.KeepAspectRatio, Globals.ShowScreenUnderFinger, Globals.LeftClickUsesMultitouch };
- items = items2;
- defaults = defaults2;
- }
- if( Globals.RightClickMethod == Globals.RIGHT_CLICK_WITH_MULTITOUCH )
- {
- Globals.LeftClickUsesMultitouch = false;
- CharSequence[] items2 = { p.getResources().getString(R.string.pointandclick_keepaspectratio),
- p.getResources().getString(R.string.pointandclick_showcreenunderfinger),
- p.getResources().getString(R.string.pointandclick_usepressure) };
- boolean defaults2[] = { Globals.KeepAspectRatio, Globals.ShowScreenUnderFinger, Globals.LeftClickUsesPressure };
- items = items2;
- defaults = defaults2;
- }
- if( ! Globals.AppNeedsTwoButtonMouse )
- {
- Globals.ShowScreenUnderFinger = false;
- Globals.LeftClickUsesPressure = false;
- Globals.LeftClickUsesMultitouch = false;
- CharSequence[] items2 = { p.getResources().getString(R.string.pointandclick_keepaspectratio) };
- boolean defaults2[] = { Globals.KeepAspectRatio };
- items = items2;
- defaults = defaults2;
- }
+
+ final CharSequence[] items = { p.getResources().getString(R.string.controls_arrows),
+ p.getResources().getString(R.string.controls_trackball),
+ p.getResources().getString(R.string.controls_touch) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
- builder.setTitle(p.getResources().getString(R.string.pointandclick_question));
- builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
- {
- public void onClick(DialogInterface dialog, int item, boolean isChecked)
- {
- if( item == 0 )
- Globals.KeepAspectRatio = isChecked;
- if( item == 1 )
- Globals.ShowScreenUnderFinger = isChecked;
- if( item == 2 )
- {
- if( Globals.RightClickMethod == Globals.RIGHT_CLICK_WITH_PRESSURE )
- Globals.LeftClickUsesMultitouch = isChecked;
- else
- Globals.LeftClickUsesPressure = isChecked;
- }
- if( item == 3 )
- Globals.LeftClickUsesMultitouch = isChecked;
- }
- });
- builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
+ builder.setTitle(p.getResources().getString(R.string.controls_question));
+ builder.setSingleChoiceItems(items, Globals.PhoneHasArrowKeys ? 0 : ( Globals.PhoneHasTrackball ? 1 : 2 ), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
+ Globals.PhoneHasArrowKeys = (item == 0);
+ Globals.PhoneHasTrackball = (item == 1);
+
+ dialog.dismiss();
+ showTrackballConfig(p);
+ }
+ });
+ AlertDialog alert = builder.create();
+ alert.setOwnerActivity(p);
+ alert.show();
+ }
+
+ static void showTrackballConfig(final MainActivity p)
+ {
+ if( ! Globals.PhoneHasTrackball )
+ {
+ Globals.TrackballDampening = 0;
+ showTouchPressureMeasurementTool(p);
+ return;
+ }
+
+ final CharSequence[] items = { p.getResources().getString(R.string.trackball_no_dampening),
+ p.getResources().getString(R.string.trackball_fast),
+ p.getResources().getString(R.string.trackball_medium),
+ p.getResources().getString(R.string.trackball_slow) };
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(p);
+ builder.setTitle(p.getResources().getString(R.string.trackball_question));
+ builder.setSingleChoiceItems(items, Globals.TrackballDampening, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int item)
+ {
+ Globals.TrackballDampening = item;
+
dialog.dismiss();
showTouchPressureMeasurementTool(p);
}
});
-
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
-
+
+ static void showTouchPressureMeasurementTool(final MainActivity p)
+ {
+ if( Globals.RightClickMethod == Globals.RIGHT_CLICK_WITH_PRESSURE || Globals.LeftClickMethod == Globals.LEFT_CLICK_WITH_PRESSURE )
+ {
+ p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
+ p._touchMeasurementTool = new TouchMeasurementTool(p);
+ }
+ else
+ {
+ Save(p);
+ p.startDownloader();
+ }
+ }
+
public static class TouchMeasurementTool
{
MainActivity p;
@@ -631,21 +609,6 @@ class Settings
}
}
- static void showTouchPressureMeasurementTool(final MainActivity p)
- {
- if( Globals.RightClickMethod == Globals.RIGHT_CLICK_WITH_PRESSURE || Globals.LeftClickUsesPressure )
- {
- p.setText(p.getResources().getString(R.string.measurepressure_touchplease));
- p._touchMeasurementTool = new TouchMeasurementTool(p);
- }
- else
- {
- Save(p);
- p.startDownloader();
- }
- }
-
-
static void Apply(Activity p)
{
nativeIsSdcardUsed( Globals.DownloadToSdcard ? 1 : 0 );
@@ -655,8 +618,8 @@ class Settings
if( Globals.AppUsesMouse )
nativeSetMouseUsed( Globals.RightClickMethod,
Globals.ShowScreenUnderFinger ? 1 : 0,
- Globals.LeftClickUsesPressure ? 1 : 0,
- Globals.LeftClickUsesMultitouch ? 1 : 0,
+ Globals.LeftClickMethod,
+ Globals.MoveMouseWithJoystick ? 1 : 0,
Globals.ClickScreenPressure,
Globals.ClickScreenTouchspotSize );
if( Globals.AppUsesJoystick && (Globals.UseAccelerometerAsArrowKeys || Globals.UseTouchscreenKeyboard) )
@@ -718,7 +681,7 @@ class Settings
private static native void nativeSetTrackballUsed();
private static native void nativeSetTrackballDampening(int value);
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
- private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickUsesPressure, int LeftClickUsesMultitouch, int MaxForce, int MaxRadius);
+ private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod, int MoveMouseWithJoystick, int MaxForce, int MaxRadius);
private static native void nativeSetJoystickUsed();
private static native void nativeSetMultitouchUsed();
private static native void nativeSetTouchscreenKeyboardUsed();
diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml
index b063131d2..9c1340631 100644
--- a/project/java/translations/values/strings.xml
+++ b/project/java/translations/values/strings.xml
@@ -59,16 +59,23 @@
Fixed to table desk orientation
Accelerometer center position
- Right mouse click triggered by:
+ Right mouse click:
Menu key
Touch screen with second finger
Touch screen with force
+ Disable right mouse click
+
+ Left mouse click:
+ Normal
+ Touch near mouse cursor
+ Touch screen with second finger
+ Touch screen with force
+ Trackball click / select key
Advanced features
Keep 4:3 screen aspect ratio
Show screen under finger in separate window
- Left click triggered by touch force
- Left click triggered by touch with second finger
+ Move mouse with joystick or trackball
Please slide finger across the screen for two seconds
Pressure %03d radius %03d
diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c
index 8af883330..075c55182 100644
--- a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c
+++ b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c
@@ -55,12 +55,16 @@ static inline SDL_scancode TranslateKey(int scancode)
static int isTrackballUsed = 0;
static int isMouseUsed = 0;
-enum { RIGHT_CLICK_NONE = 0, RIGHT_CLICK_WITH_MENU_BUTTON = 1, RIGHT_CLICK_WITH_MULTITOUCH = 2, RIGHT_CLICK_WITH_PRESSURE = 3 };
+
+enum { RIGHT_CLICK_NONE = 0, RIGHT_CLICK_WITH_MULTITOUCH = 1, RIGHT_CLICK_WITH_PRESSURE = 2, RIGHT_CLICK_WITH_MENU_BUTTON = 3 };
+enum { LEFT_CLICK_NORMAL = 0, LEFT_CLICK_NEAR_CURSOR = 1, LEFT_CLICK_WITH_MULTITOUCH = 2, LEFT_CLICK_WITH_PRESSURE = 3, LEFT_CLICK_WITH_DPAD_CENTER = 4 };
+static int leftClickMethod = LEFT_CLICK_NORMAL;
static int rightClickMethod = RIGHT_CLICK_NONE;
int SDL_ANDROID_ShowScreenUnderFinger = 0;
SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect = {0, 0, 0, 0}, SDL_ANDROID_ShowScreenUnderFingerRectSrc = {0, 0, 0, 0};
-static int leftClickUsesPressure = 0;
-static int leftClickUsesMultitouch = 0;
+static int moveMouseWithArrowKeys = 0;
+static int clickDoesNotMoveMouseX = -1, clickDoesNotMoveMouseY = -1;
+static int clickDoesNotMoveMouseXspeed = 0, clickDoesNotMoveMouseYspeed = 0;
static int maxForce = 0;
static int maxRadius = 0;
int SDL_ANDROID_isJoystickUsed = 0;
@@ -188,7 +192,8 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
if( pointerId == 0 )
{
- SDL_ANDROID_MainThreadPushMouseMotion(x, y);
+ int oldX, oldY;
+ SDL_GetMouseState( &oldX, &oldY );
if( action == MOUSE_UP )
{
if( SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON(SDL_BUTTON_LEFT) )
@@ -198,21 +203,75 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
SDL_ANDROID_ShowScreenUnderFingerRect.w = SDL_ANDROID_ShowScreenUnderFingerRect.h = 0;
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = 0;
if( SDL_ANDROID_ShowScreenUnderFinger )
- SDL_ANDROID_MainThreadPushMouseMotion(x > 0 ? x-1 : 0, y); // Move mouse by 1 pixel so it will force screen update and mouse-under-finger window will be removed
+ {
+ // Move mouse by 1 pixel so it will force screen update and mouse-under-finger window will be removed
+ if( clickDoesNotMoveMouseX >= 0 )
+ SDL_ANDROID_MainThreadPushMouseMotion(clickDoesNotMoveMouseX > 0 ? clickDoesNotMoveMouseX-1 : 0, clickDoesNotMoveMouseY);
+ else
+ SDL_ANDROID_MainThreadPushMouseMotion(x > 0 ? x-1 : 0, y);
+ }
+ clickDoesNotMoveMouseX = -1;
+ clickDoesNotMoveMouseY = -1;
+ clickDoesNotMoveMouseXspeed = 0;
+ clickDoesNotMoveMouseYspeed = 0;
}
if( action == MOUSE_DOWN )
{
- if( !leftClickUsesPressure && !leftClickUsesMultitouch )
+ if( (clickDoesNotMoveMouseX >= 0 || leftClickMethod == LEFT_CLICK_NEAR_CURSOR) &&
+ abs(oldX - x) < SDL_ANDROID_sFakeWindowWidth / 4 && abs(oldY - y) < SDL_ANDROID_sFakeWindowHeight / 4 )
+ {
SDL_ANDROID_MainThreadPushMouseButton( SDL_PRESSED, SDL_BUTTON_LEFT );
- else
+ clickDoesNotMoveMouseX = oldX;
+ clickDoesNotMoveMouseY = oldY;
action == MOUSE_MOVE;
+ }
+ else
+ if( leftClickMethod == LEFT_CLICK_NORMAL )
+ {
+ SDL_ANDROID_MainThreadPushMouseMotion(x, y);
+ SDL_ANDROID_MainThreadPushMouseButton( SDL_PRESSED, SDL_BUTTON_LEFT );
+ }
+ else
+ {
+ SDL_ANDROID_MainThreadPushMouseMotion(x, y);
+ action == MOUSE_MOVE;
+ }
UpdateScreenUnderFingerRect(x, y);
}
if( action == MOUSE_MOVE )
{
- if( rightClickMethod == RIGHT_CLICK_WITH_PRESSURE || leftClickUsesPressure )
+ if( clickDoesNotMoveMouseX >= 0 )
{
- int button = leftClickUsesPressure ? SDL_BUTTON_LEFT : SDL_BUTTON_RIGHT;
+ if( abs(clickDoesNotMoveMouseX - x) > SDL_ANDROID_sFakeWindowWidth / 10 )
+ clickDoesNotMoveMouseXspeed += clickDoesNotMoveMouseX > x ? -1 : 1;
+ else
+ clickDoesNotMoveMouseXspeed = clickDoesNotMoveMouseXspeed * 2 / 3;
+ if( abs(clickDoesNotMoveMouseY - y) > SDL_ANDROID_sFakeWindowHeight / 10 )
+ clickDoesNotMoveMouseYspeed += clickDoesNotMoveMouseY > y ? -1 : 1;
+ else
+ clickDoesNotMoveMouseYspeed = clickDoesNotMoveMouseYspeed * 2 / 3;
+
+ clickDoesNotMoveMouseX += clickDoesNotMoveMouseXspeed;
+ clickDoesNotMoveMouseY += clickDoesNotMoveMouseYspeed;
+
+ if( abs(clickDoesNotMoveMouseX - x) > SDL_ANDROID_sFakeWindowWidth / 5 ||
+ abs(clickDoesNotMoveMouseY - y) > SDL_ANDROID_sFakeWindowHeight / 5 )
+ {
+ clickDoesNotMoveMouseX = -1;
+ clickDoesNotMoveMouseY = -1;
+ clickDoesNotMoveMouseXspeed = 0;
+ clickDoesNotMoveMouseYspeed = 0;
+ SDL_ANDROID_MainThreadPushMouseMotion(x, y);
+ }
+ else
+ SDL_ANDROID_MainThreadPushMouseMotion(clickDoesNotMoveMouseX, clickDoesNotMoveMouseY);
+ }
+ else
+ SDL_ANDROID_MainThreadPushMouseMotion(x, y);
+
+ if( rightClickMethod == RIGHT_CLICK_WITH_PRESSURE || leftClickMethod == LEFT_CLICK_WITH_PRESSURE )
+ {
+ int button = (leftClickMethod == LEFT_CLICK_WITH_PRESSURE) ? SDL_BUTTON_LEFT : SDL_BUTTON_RIGHT;
int buttonState = ( force > maxForce || radius > maxRadius );
if( button == SDL_BUTTON_RIGHT && (SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON(SDL_BUTTON_LEFT)) )
SDL_ANDROID_MainThreadPushMouseButton( SDL_RELEASED, SDL_BUTTON_LEFT );
@@ -224,7 +283,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
}
if( pointerId == 1 && (action == MOUSE_DOWN || action == MOUSE_UP) )
{
- if( leftClickUsesMultitouch )
+ if( leftClickMethod == LEFT_CLICK_WITH_MULTITOUCH )
{
SDL_ANDROID_MainThreadPushMouseButton( (action == MOUSE_DOWN) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT );
}
@@ -252,7 +311,31 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT );
return;
}
- SDL_keysym keysym;
+ if( key == KEYCODE_DPAD_CENTER && leftClickMethod == LEFT_CLICK_WITH_DPAD_CENTER )
+ {
+ SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT );
+ return;
+ }
+
+ if( moveMouseWithArrowKeys && (
+ key == KEYCODE_DPAD_UP || key == KEYCODE_DPAD_DOWN ||
+ key == KEYCODE_DPAD_LEFT || key == KEYCODE_DPAD_RIGHT) )
+ {
+ if( clickDoesNotMoveMouseX < 0 )
+ SDL_GetMouseState( &clickDoesNotMoveMouseX, &clickDoesNotMoveMouseY );
+
+ if( key == KEYCODE_DPAD_LEFT || key == KEYCODE_DPAD_RIGHT )
+ clickDoesNotMoveMouseXspeed += key == KEYCODE_DPAD_LEFT ? -1 : 1;
+ else
+ clickDoesNotMoveMouseXspeed = 0;
+ if( key == KEYCODE_DPAD_UP || key == KEYCODE_DPAD_DOWN )
+ clickDoesNotMoveMouseYspeed += key == KEYCODE_DPAD_UP ? -1 : 1;
+
+ clickDoesNotMoveMouseX += clickDoesNotMoveMouseXspeed;
+ clickDoesNotMoveMouseY += clickDoesNotMoveMouseYspeed;
+ SDL_ANDROID_MainThreadPushMouseMotion(clickDoesNotMoveMouseX, clickDoesNotMoveMouseY);
+ return;
+ }
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, TranslateKey(key) );
}
@@ -298,13 +381,13 @@ JAVA_EXPORT_NAME(Settings_nativeSetTrackballUsed) ( JNIEnv* env, jobject thiz)
}
JNIEXPORT void JNICALL
-JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) ( JNIEnv* env, jobject thiz, jint RightClickMethod, jint ShowScreenUnderFinger, jint LeftClickUsesPressure, jint LeftClickUsesMultitouch, jint MaxForce, jint MaxRadius)
+JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) ( JNIEnv* env, jobject thiz, jint RightClickMethod, jint ShowScreenUnderFinger, jint LeftClickMethod, jint MoveMouseWithJoystick, jint MaxForce, jint MaxRadius)
{
isMouseUsed = 1;
rightClickMethod = RightClickMethod;
SDL_ANDROID_ShowScreenUnderFinger = ShowScreenUnderFinger;
- leftClickUsesPressure = LeftClickUsesPressure;
- leftClickUsesMultitouch = LeftClickUsesMultitouch;
+ moveMouseWithArrowKeys = MoveMouseWithJoystick;
+ leftClickMethod = LeftClickMethod;
maxForce = MaxForce;
maxRadius = MaxRadius;
}
diff --git a/todo.txt b/todo.txt
index f7e6a0114..cf978a6b6 100644
--- a/todo.txt
+++ b/todo.txt
@@ -13,9 +13,9 @@ Bugs to fix
- Add an option for overlay buttons transparency and button images size.
-- Option to move mouse with arrow keys.
+- Generic keycode remapper.
-- Left-click with double-tap option.
+- Show/hide screen controls with longpress on Text Edit button.
- Zoom and rotate multitouch gestures should return some keycodes.