mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-22 20:43:03 +00:00
added support for keyboard modifier keys
This commit is contained in:
parent
895c123b13
commit
87152e6403
@ -319,7 +319,7 @@ public class NvConnection {
|
||||
});
|
||||
}
|
||||
|
||||
public void sendKeyboardInput(final short keyMap, final byte keyDirection) {
|
||||
public void sendKeyboardInput(final short keyMap, final byte keyDirection, final byte modifier) {
|
||||
if (inputStream == null)
|
||||
return;
|
||||
|
||||
@ -327,7 +327,7 @@ public class NvConnection {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
inputStream.sendKeyboardInput(keyMap, keyDirection);
|
||||
inputStream.sendKeyboardInput(keyMap, keyDirection, modifier);
|
||||
} catch (IOException e) {
|
||||
listener.displayMessage(e.getMessage());
|
||||
NvConnection.this.stop();
|
||||
|
@ -10,13 +10,20 @@ public class KeyboardPacket extends InputPacket {
|
||||
public static final byte KEY_DOWN = 0x03;
|
||||
public static final byte KEY_UP = 0x04;
|
||||
|
||||
public static final byte MODIFIER_SHIFT = 0x01;
|
||||
public static final byte MODIFIER_CTRL = 0x02;
|
||||
public static final byte MODIFIER_ALT = 0x04;
|
||||
|
||||
|
||||
private short keyCode;
|
||||
private byte keyDirection;
|
||||
private byte modifier;
|
||||
|
||||
public KeyboardPacket(short keyCode, byte keyDirection) {
|
||||
public KeyboardPacket(short keyCode, byte keyDirection, byte modifier) {
|
||||
super(PACKET_TYPE);
|
||||
this.keyCode = keyCode;
|
||||
this.keyDirection = keyDirection;
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public byte[] toWireHeader()
|
||||
@ -37,7 +44,7 @@ public class KeyboardPacket extends InputPacket {
|
||||
bb.putShort((short)0);
|
||||
bb.putShort((short)0);
|
||||
bb.putShort(keyCode);
|
||||
bb.put((byte)0);
|
||||
bb.put(modifier);
|
||||
bb.put((byte)0);
|
||||
bb.put((byte)0);
|
||||
byte[] packet = bb.array();
|
||||
|
@ -10,11 +10,11 @@ public abstract class KeycodeTranslator {
|
||||
this.conn = conn;
|
||||
}
|
||||
|
||||
public void sendKeyDown(short keyMap) {
|
||||
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_DOWN);
|
||||
public void sendKeyDown(short keyMap, byte modifier) {
|
||||
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_DOWN, modifier);
|
||||
}
|
||||
|
||||
public void sendKeyUp(short keyMap) {
|
||||
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_UP);
|
||||
public void sendKeyUp(short keyMap, byte modifier) {
|
||||
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_UP, modifier);
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ public class NvController {
|
||||
out.flush();
|
||||
}
|
||||
|
||||
public void sendKeyboardInput(short keyMap, byte keyDirection) throws IOException
|
||||
public void sendKeyboardInput(short keyMap, byte keyDirection, byte modifier) throws IOException
|
||||
{
|
||||
out.write(new KeyboardPacket(keyMap, keyDirection).toWire());
|
||||
out.write(new KeyboardPacket(keyMap, keyDirection, modifier).toWire());
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user