Skip to content

Commit cde8ec8

Browse files
committed
Add vertical mouse scrolling support
1 parent ef1429a commit cde8ec8

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

libs/limelight-common.jar

974 Bytes
Binary file not shown.

src/com/limelight/Game.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,19 @@ public boolean onGenericMotionEvent(MotionEvent event) {
503503
}
504504
}
505505
else if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0)
506-
{
507-
// Send a mouse move update (if neccessary)
508-
updateMousePosition((int)event.getX(), (int)event.getY());
506+
{
507+
switch (event.getActionMasked())
508+
{
509+
case MotionEvent.ACTION_HOVER_MOVE:
510+
// Send a mouse move update (if neccessary)
511+
updateMousePosition((int)event.getX(), (int)event.getY());
512+
break;
513+
case MotionEvent.ACTION_SCROLL:
514+
// Send the vertical scroll packet
515+
byte vScrollClicks = (byte) event.getAxisValue(MotionEvent.AXIS_VSCROLL);
516+
conn.sendMouseScroll(vScrollClicks);
517+
break;
518+
}
509519
return true;
510520
}
511521

@@ -680,4 +690,9 @@ public void mouseButtonEvent(int buttonId, boolean down) {
680690
conn.sendMouseButtonUp(buttonIndex);
681691
}
682692
}
693+
694+
@Override
695+
public void mouseScroll(byte amount) {
696+
conn.sendMouseScroll(amount);
697+
}
683698
}

src/com/limelight/binding/input/evdev/EvdevEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class EvdevEvent {
1212
/* Relative axes */
1313
public static final short REL_X = 0x00;
1414
public static final short REL_Y = 0x01;
15+
public static final short REL_WHEEL = 0x08;
1516

1617
/* Buttons */
1718
public static final short BTN_LEFT = 0x110;

src/com/limelight/binding/input/evdev/EvdevHandler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public void run() {
4545
try {
4646
int deltaX = 0;
4747
int deltaY = 0;
48+
byte deltaScroll = 0;
4849

4950
while (!isInterrupted() && !shutdown) {
5051
EvdevEvent event = EvdevReader.read(fd, buffer);
@@ -59,6 +60,10 @@ public void run() {
5960
listener.mouseMove(deltaX, deltaY);
6061
deltaX = deltaY = 0;
6162
}
63+
if (deltaScroll != 0) {
64+
listener.mouseScroll(deltaScroll);
65+
deltaScroll = 0;
66+
}
6267
break;
6368

6469
case EvdevEvent.EV_REL:
@@ -70,6 +75,9 @@ public void run() {
7075
case EvdevEvent.REL_Y:
7176
deltaY = event.value;
7277
break;
78+
case EvdevEvent.REL_WHEEL:
79+
deltaScroll = (byte) event.value;
80+
break;
7381
}
7482
break;
7583

src/com/limelight/binding/input/evdev/EvdevListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public interface EvdevListener {
77

88
public void mouseMove(int deltaX, int deltaY);
99
public void mouseButtonEvent(int buttonId, boolean down);
10+
public void mouseScroll(byte amount);
1011
}

0 commit comments

Comments
 (0)