mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-10-23 16:43:59 +00:00
Add vertical mouse scrolling support
This commit is contained in:
1 parent
ef1429a639
commit
cde8ec8262
5 files changed
+28
-3
No files matched your search
@@ -12,6 +12,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_WHEEL = 0x08;
|
||||
|
||||
/* Buttons */
|
||||
public static final short BTN_LEFT = 0x110;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class EvdevHandler {
|
||||
try {
|
||||
int deltaX = 0;
|
||||
int deltaY = 0;
|
||||
byte deltaScroll = 0;
|
||||
|
||||
while (!isInterrupted() && !shutdown) {
|
||||
EvdevEvent event = EvdevReader.read(fd, buffer);
|
||||
@@ -59,6 +60,10 @@ public class EvdevHandler {
|
||||
listener.mouseMove(deltaX, deltaY);
|
||||
deltaX = deltaY = 0;
|
||||
}
|
||||
if (deltaScroll != 0) {
|
||||
listener.mouseScroll(deltaScroll);
|
||||
deltaScroll = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case EvdevEvent.EV_REL:
|
||||
@@ -70,6 +75,9 @@ public class EvdevHandler {
|
||||
case EvdevEvent.REL_Y:
|
||||
deltaY = event.value;
|
||||
break;
|
||||
case EvdevEvent.REL_WHEEL:
|
||||
deltaScroll = (byte) event.value;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -7,4 +7,5 @@ public interface EvdevListener {
|
||||
|
||||
public void mouseMove(int deltaX, int deltaY);
|
||||
public void mouseButtonEvent(int buttonId, boolean down);
|
||||
public void mouseScroll(byte amount);
|
||||
}
|
||||
Reference in new issue
Block a user