mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-09 01:16:22 +00:00
@@ -110,6 +110,9 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
break;
|
||||
}
|
||||
|
||||
// Note: The EvdevReader process already filters input events when grabbing
|
||||
// is not enabled, so we don't need to that here.
|
||||
|
||||
switch (event.type) {
|
||||
case EvdevEvent.EV_SYN:
|
||||
if (deltaX != 0 || deltaY != 0) {
|
||||
@@ -231,35 +234,8 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCapture() {
|
||||
super.enableCapture();
|
||||
if (!started) {
|
||||
// Start the handler thread if it's our first time
|
||||
// capturing
|
||||
handlerThread.start();
|
||||
started = true;
|
||||
}
|
||||
else {
|
||||
// This may be called on the main thread
|
||||
runInNetworkSafeContextSynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Send a request to regrab if we're already capturing
|
||||
if (!shutdown && evdevOut != null) {
|
||||
try {
|
||||
evdevOut.write(REGRAB_REQUEST);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCapture() {
|
||||
super.disableCapture();
|
||||
public void showCursor() {
|
||||
super.showCursor();
|
||||
// This may be called on the main thread
|
||||
runInNetworkSafeContextSynchronously(new Runnable() {
|
||||
@Override
|
||||
@@ -275,6 +251,39 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideCursor() {
|
||||
super.hideCursor();
|
||||
// This may be called on the main thread
|
||||
runInNetworkSafeContextSynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Send a request to regrab if we're already capturing
|
||||
if (started && !shutdown && evdevOut != null) {
|
||||
try {
|
||||
evdevOut.write(REGRAB_REQUEST);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCapture() {
|
||||
if (!started) {
|
||||
// Start the handler thread if it's our first time
|
||||
// capturing
|
||||
handlerThread.start();
|
||||
started = true;
|
||||
}
|
||||
|
||||
// Call the superclass only after we've started the handler thread.
|
||||
// It will invoke hideCursor() when we call it.
|
||||
super.enableCapture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// We need to stop the process in this context otherwise
|
||||
|
||||
Reference in New Issue
Block a user