mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-23 13:02:45 +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)
|
if (inputStream == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ public class NvConnection {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
inputStream.sendKeyboardInput(keyMap, keyDirection);
|
inputStream.sendKeyboardInput(keyMap, keyDirection, modifier);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
listener.displayMessage(e.getMessage());
|
listener.displayMessage(e.getMessage());
|
||||||
NvConnection.this.stop();
|
NvConnection.this.stop();
|
||||||
|
@ -10,13 +10,20 @@ public class KeyboardPacket extends InputPacket {
|
|||||||
public static final byte KEY_DOWN = 0x03;
|
public static final byte KEY_DOWN = 0x03;
|
||||||
public static final byte KEY_UP = 0x04;
|
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 short keyCode;
|
||||||
private byte keyDirection;
|
private byte keyDirection;
|
||||||
|
private byte modifier;
|
||||||
|
|
||||||
public KeyboardPacket(short keyCode, byte keyDirection) {
|
public KeyboardPacket(short keyCode, byte keyDirection, byte modifier) {
|
||||||
super(PACKET_TYPE);
|
super(PACKET_TYPE);
|
||||||
this.keyCode = keyCode;
|
this.keyCode = keyCode;
|
||||||
this.keyDirection = keyDirection;
|
this.keyDirection = keyDirection;
|
||||||
|
this.modifier = modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] toWireHeader()
|
public byte[] toWireHeader()
|
||||||
@ -37,7 +44,7 @@ public class KeyboardPacket extends InputPacket {
|
|||||||
bb.putShort((short)0);
|
bb.putShort((short)0);
|
||||||
bb.putShort((short)0);
|
bb.putShort((short)0);
|
||||||
bb.putShort(keyCode);
|
bb.putShort(keyCode);
|
||||||
bb.put((byte)0);
|
bb.put(modifier);
|
||||||
bb.put((byte)0);
|
bb.put((byte)0);
|
||||||
bb.put((byte)0);
|
bb.put((byte)0);
|
||||||
byte[] packet = bb.array();
|
byte[] packet = bb.array();
|
||||||
|
@ -10,11 +10,11 @@ public abstract class KeycodeTranslator {
|
|||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeyDown(short keyMap) {
|
public void sendKeyDown(short keyMap, byte modifier) {
|
||||||
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_DOWN);
|
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_DOWN, modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendKeyUp(short keyMap) {
|
public void sendKeyUp(short keyMap, byte modifier) {
|
||||||
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_UP);
|
conn.sendKeyboardInput(keyMap, KeyboardPacket.KEY_UP, modifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,9 @@ public class NvController {
|
|||||||
out.flush();
|
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();
|
out.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user