mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-08 19:46:10 +01:00
terminal-view: add "ctrl-space-workaround" property
Makes it possible to run ctrl+space with hardware keyboards on devices/ROMs where it otherwise is broken. On devices where it already works this workaround breaks ctrl+space though. Where to add this fix was investigated and found by @5bodnar.
This commit is contained in:
parent
b467b68f7b
commit
f1e973f0d2
1 changed files with 7 additions and 0 deletions
|
|
@ -539,6 +539,8 @@ public final class TerminalView extends View {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
||||||
|
Properties props = getProperties();
|
||||||
|
|
||||||
if (LOG_KEY_EVENTS)
|
if (LOG_KEY_EVENTS)
|
||||||
Log.i(EmulatorDebug.LOG_TAG, "onKeyPreIme(keyCode=" + keyCode + ", event=" + event + ")");
|
Log.i(EmulatorDebug.LOG_TAG, "onKeyPreIme(keyCode=" + keyCode + ", event=" + event + ")");
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
|
@ -554,6 +556,11 @@ public final class TerminalView extends View {
|
||||||
return onKeyUp(keyCode, event);
|
return onKeyUp(keyCode, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (props.getProperty("ctrl-space-workaround", "false").equals("true") &&
|
||||||
|
keyCode == KeyEvent.KEYCODE_SPACE && event.isCtrlPressed()) {
|
||||||
|
/* ctrl + space does not work on some ROMs without this workaround.
|
||||||
|
However, this breaks it on devices where it works out of the box. */
|
||||||
|
return onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
return super.onKeyPreIme(keyCode, event);
|
return super.onKeyPreIme(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue