moonlight-stream / moonlight-stream/moonlight-android

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

Open
#1,332 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
7.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with game.java and the shown onBackPressed callback, then trace how conn.sendKeyboardInput handles translated key events. Reproduce pressing ESC during a remote game session and determine how the event currently causes the connection to close. Done means ESC reaches the PC as a keyboard input without breaking the remote connection.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.