mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-03 00:06:34 +00:00
Implement horizontal scrolling with Sunshine
This commit is contained in:
parent
91dd7b7049
commit
f4df0714b5
@ -1521,6 +1521,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_SCROLL) {
|
||||
// Send the vertical scroll packet
|
||||
conn.sendMouseHighResScroll((short)(event.getAxisValue(MotionEvent.AXIS_VSCROLL) * 120));
|
||||
conn.sendMouseHighResHScroll((short)(event.getAxisValue(MotionEvent.AXIS_HSCROLL) * 120));
|
||||
}
|
||||
|
||||
if ((changedButtons & MotionEvent.BUTTON_PRIMARY) != 0) {
|
||||
@ -2187,10 +2188,15 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseScroll(byte amount) {
|
||||
public void mouseVScroll(byte amount) {
|
||||
conn.sendMouseScroll(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseHScroll(byte amount) {
|
||||
conn.sendMouseHScroll(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyboardEvent(boolean buttonDown, short keyCode) {
|
||||
short keyMap = keyboardTranslator.translate(keyCode, -1);
|
||||
|
@ -9,6 +9,7 @@ public interface EvdevListener {
|
||||
|
||||
void mouseMove(int deltaX, int deltaY);
|
||||
void mouseButtonEvent(int buttonId, boolean down);
|
||||
void mouseScroll(byte amount);
|
||||
void mouseVScroll(byte amount);
|
||||
void mouseHScroll(byte amount);
|
||||
void keyboardEvent(boolean buttonDown, short keyCode);
|
||||
}
|
||||
|
@ -513,7 +513,13 @@ public class NvConnection {
|
||||
|
||||
public void sendMouseScroll(final byte scrollClicks) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendMouseScroll(scrollClicks);
|
||||
MoonBridge.sendMouseHighResScroll((short)(scrollClicks * 120)); // WHEEL_DELTA
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMouseHScroll(final byte scrollClicks) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendMouseHighResHScroll((short)(scrollClicks * 120)); // WHEEL_DELTA
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,6 +529,12 @@ public class NvConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMouseHighResHScroll(final short scrollAmount) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendMouseHighResHScroll(scrollAmount);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendUtf8Text(final String text) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendUtf8Text(text);
|
||||
|
@ -307,12 +307,12 @@ public class MoonBridge {
|
||||
short leftStickX, short leftStickY,
|
||||
short rightStickX, short rightStickY);
|
||||
|
||||
|
||||
public static native void sendMouseScroll(byte scrollClicks);
|
||||
public static native void sendKeyboardInput(short keyMap, byte keyDirection, byte modifier, byte flags);
|
||||
|
||||
public static native void sendMouseHighResScroll(short scrollAmount);
|
||||
|
||||
public static native void sendMouseHighResHScroll(short scrollAmount);
|
||||
|
||||
public static native void sendUtf8Text(String text);
|
||||
|
||||
public static native String getStageName(int stage);
|
||||
|
@ -52,13 +52,13 @@ Java_com_limelight_nvstream_jni_MoonBridge_sendKeyboardInput(JNIEnv *env, jclass
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_sendMouseScroll(JNIEnv *env, jclass clazz, jbyte scrollClicks) {
|
||||
LiSendScrollEvent(scrollClicks);
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_sendMouseHighResScroll(JNIEnv *env, jclass clazz, jshort scrollAmount) {
|
||||
LiSendHighResScrollEvent(scrollAmount);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_sendMouseHighResScroll(JNIEnv *env, jclass clazz, jshort scrollAmount) {
|
||||
LiSendHighResScrollEvent(scrollAmount);
|
||||
Java_com_limelight_nvstream_jni_MoonBridge_sendMouseHighResHScroll(JNIEnv *env, jclass clazz, jshort scrollAmount) {
|
||||
LiSendHighResHScrollEvent(scrollAmount);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
@ -38,7 +38,8 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
public void run() {
|
||||
int deltaX = 0;
|
||||
int deltaY = 0;
|
||||
byte deltaScroll = 0;
|
||||
byte deltaVScroll = 0;
|
||||
byte deltaHScroll = 0;
|
||||
|
||||
// Bind a local listening socket for evdevreader to connect to
|
||||
try {
|
||||
@ -115,9 +116,13 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
listener.mouseMove(deltaX, deltaY);
|
||||
deltaX = deltaY = 0;
|
||||
}
|
||||
if (deltaScroll != 0) {
|
||||
listener.mouseScroll(deltaScroll);
|
||||
deltaScroll = 0;
|
||||
if (deltaVScroll != 0) {
|
||||
listener.mouseVScroll(deltaVScroll);
|
||||
deltaVScroll = 0;
|
||||
}
|
||||
if (deltaHScroll != 0) {
|
||||
listener.mouseHScroll(deltaHScroll);
|
||||
deltaHScroll = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -129,8 +134,11 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
case EvdevEvent.REL_Y:
|
||||
deltaY = event.value;
|
||||
break;
|
||||
case EvdevEvent.REL_HWHEEL:
|
||||
deltaHScroll = (byte) event.value;
|
||||
break;
|
||||
case EvdevEvent.REL_WHEEL:
|
||||
deltaScroll = (byte) event.value;
|
||||
deltaVScroll = (byte) event.value;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -13,6 +13,7 @@ public class EvdevEvent {
|
||||
/* Relative axes */
|
||||
public static final short REL_X = 0x00;
|
||||
public static final short REL_Y = 0x01;
|
||||
public static final short REL_HWHEEL = 0x06;
|
||||
public static final short REL_WHEEL = 0x08;
|
||||
|
||||
/* Buttons */
|
||||
|
Loading…
x
Reference in New Issue
Block a user