moonlight-android icon indicating copy to clipboard operation
moonlight-android copied to clipboard

[Feature request]: how to send the keyboard Button signal "ESC" to PC in the game?

Open daxue2017 opened this issue 5 months ago • 1 comments

when open the remote connection for a game, then press the keyboard button "ESC" to quit the game, but the remote connection is broked and moonlight back to the other window.

so how to send the keyboard Button signal "ESC" to PC in the game?

should i modify some code in the file "game.java"?

i add the callback function in the game.java, but it seems can not send the signal to the pc, is it right ?, as follows

@Override
public void onBackPressed() {
    if(!prefConfig.touchscreenTrackpad){
        byte modifier = 0;
        short translated = keyboardTranslator.translate(KeyEvent.KEYCODE_ESCAPE, KeyCharacterMap.VIRTUAL_KEYBOARD);
        conn.sendKeyboardInput(translated, KeyboardPacket.KEY_UP, modifier, keyboardTranslator.hasNormalizedMapping(KeyEvent.KEYCODE_ESCAPE, KeyCharacterMap.FULL) ? 0 : MoonBridge.SS_KBE_FLAG_NON_NORMALIZED);
        return;
    }
    super.onBackPressed();
}

i think may be should provide some interface or funtion to send the keyboard key signals

daxue2017 avatar Feb 20 '24 06:02 daxue2017

There's a pr for adding an interface which looks to be on the agenda to being merged in the future

If you're still able to open a stream I use Hackers keyboard to get the ESC key to be pass through.

StanLindsey avatar May 01 '24 21:05 StanLindsey