diff --git a/changeAppSettings.sh b/changeAppSettings.sh index 16406a878..c6547e6a7 100755 --- a/changeAppSettings.sh +++ b/changeAppSettings.sh @@ -1469,6 +1469,7 @@ done rm -rf project/bin/classes rm -rf project/bin/res +rm -rf project/res/drawable-xhdpi/ouya_icon.png project/res/drawable/app_icon.png if which convert > /dev/null; then mkdir -p project/res/drawable-xhdpi convert project/res/drawable/icon.png -resize '732x412!' project/res/drawable-xhdpi/ouya_icon.png diff --git a/project/java/Settings.java b/project/java/Settings.java index 13b5105e6..b88829df3 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -172,6 +172,7 @@ class Settings out.writeFloat(Globals.gyro_zc); out.writeBoolean(Globals.OuyaEmulation); + out.writeBoolean(Globals.HoverJitterFilter); out.close(); settingsLoaded = true; @@ -353,6 +354,7 @@ class Settings Globals.gyro_zc = settingsFile.readFloat(); Globals.OuyaEmulation = settingsFile.readBoolean(); + Globals.HoverJitterFilter = settingsFile.readBoolean(); settingsLoaded = true; diff --git a/project/java/SettingsMenuMouse.java b/project/java/SettingsMenuMouse.java index 8594beca3..226f84667 100644 --- a/project/java/SettingsMenuMouse.java +++ b/project/java/SettingsMenuMouse.java @@ -414,12 +414,14 @@ class SettingsMenuMouse extends SettingsMenu void run (final MainActivity p) { CharSequence[] items = { + p.getResources().getString(R.string.hover_jitter_filter), p.getResources().getString(R.string.pointandclick_joystickmouse), p.getResources().getString(R.string.click_with_dpadcenter), p.getResources().getString(R.string.pointandclick_relative) }; - boolean defaults[] = { + boolean defaults[] = { + Globals.HoverJitterFilter, Globals.MoveMouseWithJoystick, Globals.ClickMouseWithDpad, Globals.RelativeMouseMovement @@ -433,10 +435,12 @@ class SettingsMenuMouse extends SettingsMenu public void onClick(DialogInterface dialog, int item, boolean isChecked) { if( item == 0 ) - Globals.MoveMouseWithJoystick = isChecked; + Globals.HoverJitterFilter = isChecked; if( item == 1 ) - Globals.ClickMouseWithDpad = isChecked; + Globals.MoveMouseWithJoystick = isChecked; if( item == 2 ) + Globals.ClickMouseWithDpad = isChecked; + if( item == 3 ) Globals.RelativeMouseMovement = isChecked; } }); diff --git a/project/java/translations/unsupported/readme.txt b/project/java/translations/unsupported/readme.txt index 4cba99b02..ef73ff755 100644 --- a/project/java/translations/unsupported/readme.txt +++ b/project/java/translations/unsupported/readme.txt @@ -1,3 +1,3 @@ -I''ve tired of using Google Translate to create random gibberish in the languages I don't know, +I've tired of using Google Translate to create random gibberish in the languages I don't know, so from now on the only supported languages are English, Russian, Ukrainian, and French with some community support, If you wish to maintain a translation - contact me, but I will want a continuous support, not just one-time translation. \ No newline at end of file diff --git a/project/java/translations/unsupported/values-de/strings.xml b/project/java/translations/unsupported/values-de/strings.xml index d963f6da5..d3b2dc0b7 100644 --- a/project/java/translations/unsupported/values-de/strings.xml +++ b/project/java/translations/unsupported/values-de/strings.xml @@ -134,4 +134,24 @@ Uberklein (Xperia Mini) Weitere Optionen Größe der Schaltfläche Bilder +Cancel +Custom +Filter jitter for stylus/finger hover +Select action +Show all keycodes +Small, touchpad mode +Tiny, touchpad mode +Hardware mouse detected, disabling mouse emulation +Not enough RAM +This app needs %1$d Mb RAM, your device has %2$d Mb +Ignore +Calibrate gyroscope +Put your device on a flat surface +Your device does not have gyroscope +Reset config to defaults +Reset all options to default values? +Cancel data downloading? +You can resume it later, the data will not be downloaded twice. +Yes +No diff --git a/project/java/translations/unsupported/values-fi/strings.xml b/project/java/translations/unsupported/values-fi/strings.xml index 20b979950..bcab7a5a7 100644 --- a/project/java/translations/unsupported/values-fi/strings.xml +++ b/project/java/translations/unsupported/values-fi/strings.xml @@ -134,4 +134,24 @@ Tiny (Xperia Mini) Näytä enemmän vaihtoehtoja Koko painike kuvia +Cancel +Custom +Filter jitter for stylus/finger hover +Select action +Show all keycodes +Small, touchpad mode +Tiny, touchpad mode +Hardware mouse detected, disabling mouse emulation +Not enough RAM +This app needs %1$d Mb RAM, your device has %2$d Mb +Ignore +Calibrate gyroscope +Put your device on a flat surface +Your device does not have gyroscope +Reset config to defaults +Reset all options to default values? +Cancel data downloading? +You can resume it later, the data will not be downloaded twice. +Yes +No diff --git a/project/java/translations/values-fr/strings.xml b/project/java/translations/values-fr/strings.xml index abc5c397c..0d463eb8c 100644 --- a/project/java/translations/values-fr/strings.xml +++ b/project/java/translations/values-fr/strings.xml @@ -173,4 +173,7 @@ No Press BACK when done. Resize buttons by sliding on empty space. Custom +Filter jitter for stylus/finger hover +Select action +Show all keycodes diff --git a/project/java/translations/values-ru/strings.xml b/project/java/translations/values-ru/strings.xml index 4c615c60c..7015b76b5 100644 --- a/project/java/translations/values-ru/strings.xml +++ b/project/java/translations/values-ru/strings.xml @@ -22,7 +22,7 @@ Трекбол Акселерометр Только сенсорный экран -Какие на телефоне клавиши навигации? +Какие на телефоне кнопки навигации? Дополнительные элементы управления Экранная клавиатура Акселерометр @@ -43,7 +43,7 @@ Медленно Чувствительность акселерометра Правая кнопка мыши -Клавиша меню +Кнопка меню Касание экрана вторым пальцем Нажатие на экран с силой Расширенные функции @@ -80,8 +80,8 @@ Непрозрачные Эмуляции мыши Калибровка сенсорного давления -Переназначение физических клавиш -Нажмите любую клавишу, кроме HOME и POWER, вы можете использовать клавиши регулировки громкости +Переназначение физических кнопок +Нажмите любую клавишу, кроме HOME и POWER, вы можете использовать кнопки регулировки громкости Выберите код кнопки SDL Переназначение экранных кнопок Экранный джойстик @@ -99,7 +99,7 @@ Калибровка сенсорного экрана Дотроньтесь до всех краев экрана, потом нажмите Назад/BACK Настройка расположения кнопок -Нажмите клавишу Назад/BACK для завершения. Проведите по пустому месту, чтобы изменить размер кнопки +Нажмите кнопку Назад/BACK для завершения. Проведите по пустому месту, чтобы изменить размер кнопки Физическая кнопка Наэкранная лупа Настройки видео @@ -146,4 +146,7 @@ Да Нет Пользовательские настройки +Фильтровать дрожание при поднесении стилуса/пальца к экрану +Выберите действие +Показать все коды кнопок diff --git a/project/java/translations/values-uk/strings.xml b/project/java/translations/values-uk/strings.xml index 746d6aac2..c8e583034 100644 --- a/project/java/translations/values-uk/strings.xml +++ b/project/java/translations/values-uk/strings.xml @@ -145,4 +145,7 @@ Так Ні Налаштування користувача +Фільтрувати тремтіння при піднесенні стилуса/пальця до екрану +Виберіть дію +Показати всі коди кнопок diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml index e6ffc801c..ea4c5ff43 100644 --- a/project/java/translations/values/strings.xml +++ b/project/java/translations/values/strings.xml @@ -108,6 +108,7 @@ Relative mouse movement (laptop mode) Relative mouse movement speed Relative mouse movement acceleration + Filter jitter for stylus/finger hover None 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 44ecde926..02f6622a7 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 @@ -126,11 +126,10 @@ int SDL_ANDROID_currentMouseButtons = 0; static int hardwareMouseDetected = 0; enum { MOUSE_HW_BUTTON_LEFT = 1, MOUSE_HW_BUTTON_RIGHT = 2, MOUSE_HW_BUTTON_MIDDLE = 4, MOUSE_HW_BUTTON_BACK = 8, MOUSE_HW_BUTTON_FORWARD = 16, MOUSE_HW_BUTTON_MAX = MOUSE_HW_BUTTON_FORWARD }; -enum { MOUSE_HW_INPUT_FINGER = 0, MOUSE_HW_INPUT_STYLUS = 1, MOUSE_HW_INPUT_MOUSE }; -enum { DEADZONE_HOVER_FINGER = 50, DEADZONE_HOVER_STYLUS = 20 }; +enum { MOUSE_HW_INPUT_FINGER = 0, MOUSE_HW_INPUT_STYLUS = 1, MOUSE_HW_INPUT_MOUSE = 2 }; +enum { DEADZONE_HOVER_FINGER = 16, DEADZONE_HOVER_STYLUS = 32, HOVER_FREEZE_TIME = 300 }; static int hoverJitterFilter = 1; -static int hoverMoveX, hoverMoveY, hoverMoveTime, hoverMouseFreeze; - +static int hoverX, hoverY, hoverTime = 0, hoverMouseFreeze = 0, hoverDeadzone = 0; static inline int InsideRect( const SDL_Rect * r, int x, int y ) { @@ -235,6 +234,24 @@ static void AssignNewTouchPointers( int action, int pointerId ) } } +static void ClearOldTouchPointers( int action, int pointerId ) +{ + int i; + if( action == MOUSE_UP ) + { + touchPointers[pointerId] = TOUCH_PTR_UP; + firstMousePointerId = -1; + for( i = 0; i < MAX_MULTITOUCH_POINTERS; i++ ) + { + if( touchPointers[i] |= TOUCH_PTR_MOUSE ) + { + firstMousePointerId = i; + break; + } + } + } +} + static void AdjustTouchScreenCalibration( jint *xx, jint *yy ) { int x = *xx, y = *yy; @@ -392,6 +409,9 @@ static void ProcessMouseRelativeMovement( jint *xx, jint *yy, int action ) { int x = *xx, y = *yy; + if( !relativeMovement ) + return; + if( action == MOUSE_DOWN ) { relativeMovementX = SDL_ANDROID_currentMouseX - x; @@ -612,29 +632,49 @@ static void ProcessMouseMultitouch( int action, int pointerId ) } } -static void ClearOldTouchPointers( int action, int pointerId ) +static void ProcessMouseHover( jint *xx, jint *yy, int action ) { - int i; - if( action == MOUSE_UP ) + int x = *xx, y = *yy; + + if( relativeMovement || !hoverJitterFilter ) + return; + + if( action == MOUSE_HOVER ) { - touchPointers[pointerId] = TOUCH_PTR_UP; - firstMousePointerId = -1; - for( i = 0; i < MAX_MULTITOUCH_POINTERS; i++ ) + if( hoverDeadzone ) { - if( touchPointers[i] |= TOUCH_PTR_MOUSE ) + if( abs(x - hoverX) < hoverDeadzone && abs(y - hoverY) < hoverDeadzone ) { - firstMousePointerId = i; - break; + if( hoverTime == 0 ) + hoverTime = SDL_GetTicks(); + else if( !hoverMouseFreeze && SDL_GetTicks() > hoverTime + HOVER_FREEZE_TIME ) + { + hoverMouseFreeze = 1; + hoverX = x; + hoverY = y; + } + } + else + { + hoverTime = 0; + hoverMouseFreeze = 0; + hoverX = x; + hoverY = y; } } + if( !hoverMouseFreeze ) + SDL_ANDROID_MainThreadPushMouseMotion(x, y); } -} - -static void SendHoverEvents( int x, int y, int action, int pointerId ) -{ - if( action == MOUSE_HOVER && !relativeMovement ) + else if( hoverMouseFreeze && !(abs(x - hoverX) < hoverDeadzone && abs(y - hoverY) < hoverDeadzone) ) { - SDL_ANDROID_MainThreadPushMouseMotion(x, y); + hoverMouseFreeze = 0; + hoverTime = 0; + } + + if( hoverMouseFreeze ) + { + *xx = hoverX; + *yy = hoverY; } } @@ -666,10 +706,11 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMotionEvent) ( JNIEnv* env, jobject t if( !SDL_ANDROID_isMouseUsed ) return; + ProcessMouseHover( &x, &y, action ); + if( pointerId == firstMousePointerId ) { - if( relativeMovement ) - ProcessMouseRelativeMovement( &x, &y, action ); + ProcessMouseRelativeMovement( &x, &y, action ); if( action == MOUSE_UP ) ProcessMouseUp( x, y ); if( action == MOUSE_DOWN ) @@ -680,8 +721,6 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMotionEvent) ( JNIEnv* env, jobject t ProcessMouseMultitouch( action, pointerId ); ClearOldTouchPointers( action, pointerId ); - - SendHoverEvents( x, y, action, pointerId ); } void ProcessDeferredMouseTap() @@ -932,6 +971,11 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeHardwareMouseDetected) (JNIEnv* env, jo relativeMovement = cfg.relativeMovement; SDL_ANDROID_ShowMouseCursor = cfg.ShowMouseCursor; } + + int hoverDeadzone = (hardwareMouseDetected == MOUSE_HW_INPUT_STYLUS) ? + SDL_ANDROID_sFakeWindowHeight / DEADZONE_HOVER_STYLUS : + (hardwareMouseDetected == MOUSE_HW_INPUT_FINGER) ? + SDL_ANDROID_sFakeWindowHeight / DEADZONE_HOVER_FINGER : 0; } }