Skip to content

Commit b906ed4

Browse files
Maksim GamarnikZeno-
Maksim Gamarnik
authored andcommittedMay 14, 2016
Fix locked hardware buttons on Android
Fixes #2122 Fixes #1454 Addendum (est31) According from its docs in android_native_app_glue.h (from the NDK), the onInputEvent should "Return 1 if you have handled the event, 0 for any default dispatching". Before, we always returned 1, meaning we blocked all hardware keys to be given to the OS. This broke the volume keys and has caused #2122 and #1454. Although it bases on lots of guesswork, it can probably safely be said that CGUIEnvironment::postEventFromUser returns true if the event was handled, and false if not. Therefore, set the status variable depending on what postEventFromUser returned.
1 parent ec15e35 commit b906ed4

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed
 

‎build/android/patches/irrlicht-back_button.patch

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
--- irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2014-06-03 20:56:21.289559503 +0200
2-
+++ irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp.orig 2014-06-03 20:57:39.281556749 +0200
3-
@@ -423,6 +423,7 @@
4-
}
5-
6-
device->postEventFromUser(event);
7-
+ status = 1;
8-
}
9-
break;
10-
default:
11-
@@ -479,7 +480,7 @@
1+
--- irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp.orig 2015-08-29 15:43:09.000000000 +0300
2+
+++ irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2016-05-13 21:36:22.880388505 +0300
3+
@@ -486,7 +486,7 @@
4+
event.KeyInput.Char = 0;
5+
}
6+
7+
- device->postEventFromUser(event);
8+
+ status = device->postEventFromUser(event);
9+
}
10+
break;
11+
default:
12+
@@ -543,7 +543,7 @@
1213
KeyMap[1] = KEY_LBUTTON; // AKEYCODE_SOFT_LEFT
1314
KeyMap[2] = KEY_RBUTTON; // AKEYCODE_SOFT_RIGHT
1415
KeyMap[3] = KEY_HOME; // AKEYCODE_HOME

‎build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public void onCreate(Bundle savedInstanceState) {
1919
public void onDestroy() {
2020
super.onDestroy();
2121
}
22+
23+
@Override
24+
public void onBackPressed() {
25+
}
2226

2327

2428
public void copyAssets() {

0 commit comments

Comments
 (0)
Please sign in to comment.