mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-10-11 19:14:00 +00:00
Fix missing shift modifier for plus key (#1582)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user