From 8a747fc9baa03c1bf8cf51310832dabbddcfb99a Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 5 Jun 2015 20:38:42 +0300 Subject: [PATCH] Fixed right mouse button acting as Back key on Samsung devices with USB/Bluetooth mouse, bumped minimum Android version to Gingerbread. --- project/AndroidManifestTemplate.xml | 2 +- project/java/MainActivity.java | 17 +++++++++++++++-- readme.txt | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/project/AndroidManifestTemplate.xml b/project/AndroidManifestTemplate.xml index 97f4bb0f5..3f704ce62 100644 --- a/project/AndroidManifestTemplate.xml +++ b/project/AndroidManifestTemplate.xml @@ -40,7 +40,7 @@ /> - + diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java index db4d34597..4e600de5e 100644 --- a/project/java/MainActivity.java +++ b/project/java/MainActivity.java @@ -85,6 +85,7 @@ import android.app.ProgressDialog; import android.app.KeyguardManager; import android.view.ViewTreeObserver; import android.graphics.Rect; +import android.view.InputDevice; public class MainActivity extends Activity @@ -764,7 +765,13 @@ public class MainActivity extends Activity @Override public boolean onKeyDown(int keyCode, final KeyEvent event) { - if(_screenKeyboard != null) + if( keyCode == KeyEvent.KEYCODE_BACK && event.getSource() == InputDevice.SOURCE_MOUSE ) + { + // Stupid Samsung remaps right mouse button to BACK key + DemoGLSurfaceView.nativeMouseButtonsPressed(2, 1); + return true; + } + if( _screenKeyboard != null ) _screenKeyboard.onKeyDown(keyCode, event); else if( mGLView != null ) @@ -786,7 +793,13 @@ public class MainActivity extends Activity @Override public boolean onKeyUp(int keyCode, final KeyEvent event) { - if(_screenKeyboard != null) + if( keyCode == KeyEvent.KEYCODE_BACK && event.getSource() == InputDevice.SOURCE_MOUSE ) + { + // Stupid Samsung remaps right mouse button to BACK key + DemoGLSurfaceView.nativeMouseButtonsPressed(2, 0); + return true; + } + if( _screenKeyboard != null ) _screenKeyboard.onKeyUp(keyCode, event); else if( mGLView != null ) diff --git a/readme.txt b/readme.txt index 90dca23d6..234029b5b 100644 --- a/readme.txt +++ b/readme.txt @@ -14,7 +14,7 @@ Install latest Android SDK and NDK from http://developer.android.com/index.html You'll need to install Java Ant too. Since for building apk files some java classes are needed as well, it is recommended to install OpenJDK and its development files. (On RPM based distros usually called java-x.x.x-openjdk and java-x.x.x-openjdk-devel) -The application will run on Android 1.6 and above, but will use features from Android 5.1 if available. +The application will run on Android 2.3 and above, but will use features from Android 5.1 if available. The most supported environment for this port is Linux, MacOs should be okay too. If you're developing under Windows you'd better install Portable Ubuntu, to get proper Linux environment running inside Windows, then install Linux toolchain on it.