Fix missing shift modifier for plus key (#1582)

This commit is contained in:
Dave Lane
2026-09-01 01:21:36 -05:00
committed by GitHub
parent 3c6a0d12f5
commit b9c5edddef
+14 -2
View File
@@ -1293,6 +1293,18 @@ public class Game extends Activity implements SurfaceHolder.Callback,
if (event.isMetaPressed()) {
modifier |= KeyboardPacket.MODIFIER_META;
}
return applyKeySpecificModifiers(event.getKeyCode(), modifier);
}
private byte getModifierState(int keyCode) {
return applyKeySpecificModifiers(keyCode, getModifierState());
}
private byte applyKeySpecificModifiers(int keyCode, byte modifier) {
if (keyCode == KeyEvent.KEYCODE_PLUS) {
// The host protocol has a single US =/+ virtual key, so Android's semantic plus key needs Shift.
modifier |= KeyboardPacket.MODIFIER_SHIFT;
}
return modifier;
}
@@ -2612,10 +2624,10 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
if (buttonDown) {
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_DOWN, getModifierState(), (byte)0);
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_DOWN, getModifierState(keyCode), (byte)0);
}
else {
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_UP, getModifierState(), (byte)0);
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_UP, getModifierState(keyCode), (byte)0);
}
}
}