mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Add support for vertical mouse scrolling
This commit is contained in:
parent
1bb9a13c17
commit
50f8f78b8d
@ -335,4 +335,11 @@ public class NvConnection {
|
||||
|
||||
inputStream.sendKeyboardInput(keyMap, keyDirection, modifier);
|
||||
}
|
||||
|
||||
public void sendMouseScroll(final byte scrollClicks) {
|
||||
if (inputStream == null)
|
||||
return;
|
||||
|
||||
inputStream.sendMouseScroll(scrollClicks);
|
||||
}
|
||||
}
|
||||
|
@ -282,4 +282,9 @@ public class ControllerStream {
|
||||
{
|
||||
queuePacket(new KeyboardPacket(keyMap, keyDirection, modifier));
|
||||
}
|
||||
|
||||
public void sendMouseScroll(byte scrollClicks)
|
||||
{
|
||||
queuePacket(new MouseScrollPacket(scrollClicks));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.limelight.nvstream.input;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class MouseScrollPacket extends InputPacket {
|
||||
public static final int PACKET_TYPE = 0xa;
|
||||
public static final int PAYLOAD_LENGTH = 10;
|
||||
public static final int PACKET_LENGTH = PAYLOAD_LENGTH +
|
||||
InputPacket.HEADER_LENGTH;
|
||||
|
||||
short scroll;
|
||||
|
||||
public MouseScrollPacket(byte scrollClicks)
|
||||
{
|
||||
super(PACKET_TYPE);
|
||||
this.scroll = (short)(scrollClicks * 120);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] toWire() {
|
||||
ByteBuffer bb = ByteBuffer.allocate(PACKET_LENGTH);
|
||||
|
||||
bb.put(toWireHeader());
|
||||
bb.put((byte) 0x09);
|
||||
bb.put((byte) 0);
|
||||
bb.put((byte) 0);
|
||||
bb.put((byte) 0);
|
||||
|
||||
bb.putShort(scroll);
|
||||
bb.putShort(scroll);
|
||||
|
||||
bb.putShort((short) 0);
|
||||
|
||||
return bb.array();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user