Try to better detect a physical keyboard to modify the mapping of the keys (Eric issue with S7).

This commit is contained in:
dgis 2019-12-18 00:24:04 +01:00
parent 27cecc7fe3
commit 7420e20f92
4 changed files with 19 additions and 4 deletions

View file

@ -54,6 +54,11 @@ NOT WORKING YET
CHANGES
Version 1.8beta1 (2019-12-18)
- Try to better detect a physical keyboard to modify the mapping of the keys.
Version 1.7 (2019-12-12)
- Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62.

View file

@ -33,8 +33,8 @@ android {
applicationId "org.emulator.forty.eight"
minSdkVersion 19
targetSdkVersion 28
versionCode 11
versionName "1.7"
versionCode 12
versionName "1.8beta1"
setProperty("archivesBaseName", "Emu48-v$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {

View file

@ -54,6 +54,11 @@ NOT WORKING YET
CHANGES
Version 1.8beta1 (2019-12-18)
- Try to better detect a physical keyboard to modify the mapping of the keys.
Version 1.7 (2019-12-12)
- Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62.

View file

@ -25,6 +25,7 @@ import android.graphics.Paint;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseIntArray;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
@ -202,7 +203,9 @@ public class MainScreenView extends PanAndScaleView {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0) {
if(event.getDeviceId() != -1
&& (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0
&& (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
char pressedKey = (char) event.getUnicodeChar();
Integer windowsKeycode = charmap.get(pressedKey);
if(windowsKeycode == null)
@ -220,7 +223,9 @@ public class MainScreenView extends PanAndScaleView {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0) {
if(event.getDeviceId() != -1
&& (event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0
&& (event.getSource() & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
char pressedKey = (char) event.getUnicodeChar();
Integer windowsKeycode = charmap.get(pressedKey);
if(windowsKeycode == null)