mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-05 02:05:25 +08: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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user