mirror of
https://github.com/dgis/emu48android
synced 2024-12-26 09:58:49 +01:00
- Intercept the ESC keyboard key to allow the use of the BACK soft key.
This commit is contained in:
parent
7420e20f92
commit
d0ae97d7b6
4 changed files with 10 additions and 12 deletions
|
@ -54,9 +54,9 @@ NOT WORKING YET
|
||||||
|
|
||||||
CHANGES
|
CHANGES
|
||||||
|
|
||||||
Version 1.8beta1 (2019-12-18)
|
Version 1.8beta2 (2019-12-19)
|
||||||
|
|
||||||
- Try to better detect a physical keyboard to modify the mapping of the keys.
|
- Intercept the ESC keyboard key to allow the use of the BACK soft key.
|
||||||
|
|
||||||
|
|
||||||
Version 1.7 (2019-12-12)
|
Version 1.7 (2019-12-12)
|
||||||
|
|
|
@ -33,8 +33,8 @@ android {
|
||||||
applicationId "org.emulator.forty.eight"
|
applicationId "org.emulator.forty.eight"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 12
|
versionCode 13
|
||||||
versionName "1.8beta1"
|
versionName "1.8beta2"
|
||||||
setProperty("archivesBaseName", "Emu48-v$versionName")
|
setProperty("archivesBaseName", "Emu48-v$versionName")
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
|
|
|
@ -54,9 +54,9 @@ NOT WORKING YET
|
||||||
|
|
||||||
CHANGES
|
CHANGES
|
||||||
|
|
||||||
Version 1.8beta1 (2019-12-18)
|
Version 1.8beta2 (2019-12-19)
|
||||||
|
|
||||||
- Try to better detect a physical keyboard to modify the mapping of the keys.
|
- Intercept the ESC keyboard key to allow the use of the BACK soft key.
|
||||||
|
|
||||||
|
|
||||||
Version 1.7 (2019-12-12)
|
Version 1.7 (2019-12-12)
|
||||||
|
|
|
@ -203,8 +203,7 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if(event.getDeviceId() != -1
|
if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0
|
||||||
&& (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0
|
|
||||||
&& (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
|
&& (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
|
||||||
char pressedKey = (char) event.getUnicodeChar();
|
char pressedKey = (char) event.getUnicodeChar();
|
||||||
Integer windowsKeycode = charmap.get(pressedKey);
|
Integer windowsKeycode = charmap.get(pressedKey);
|
||||||
|
@ -215,7 +214,7 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
if (windowsKeycode != 0)
|
if (windowsKeycode != 0)
|
||||||
NativeLib.keyDown(windowsKeycode);
|
NativeLib.keyDown(windowsKeycode);
|
||||||
else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
|
else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
|
||||||
if(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_TAB)
|
if(keyCode == KeyEvent.KEYCODE_ESCAPE /*KEYCODE_BACK*/ || keyCode == KeyEvent.KEYCODE_TAB)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
|
@ -223,8 +222,7 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
if(event.getDeviceId() != -1
|
if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0
|
||||||
&& (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0
|
|
||||||
&& (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
|
&& (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
|
||||||
char pressedKey = (char) event.getUnicodeChar();
|
char pressedKey = (char) event.getUnicodeChar();
|
||||||
Integer windowsKeycode = charmap.get(pressedKey);
|
Integer windowsKeycode = charmap.get(pressedKey);
|
||||||
|
@ -235,7 +233,7 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
if (windowsKeycode != 0)
|
if (windowsKeycode != 0)
|
||||||
NativeLib.keyUp(windowsKeycode);
|
NativeLib.keyUp(windowsKeycode);
|
||||||
else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
|
else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
|
||||||
if(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_TAB)
|
if(keyCode == KeyEvent.KEYCODE_ESCAPE /*KEYCODE_BACK*/ || keyCode == KeyEvent.KEYCODE_TAB)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
|
|
Loading…
Reference in a new issue