mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-03 14:36:21 +00:00
Add isCapturing() method to mouse capture providers
This commit is contained in:
@@ -21,17 +21,24 @@ public class AndroidNativePointerCaptureProvider extends InputCaptureProvider {
|
||||
|
||||
@Override
|
||||
public void enableCapture() {
|
||||
super.enableCapture();
|
||||
targetView.requestPointerCapture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCapture() {
|
||||
super.disableCapture();
|
||||
targetView.releasePointerCapture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCapturing() {
|
||||
return targetView.hasPointerCapture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventHasRelativeMouseAxes(MotionEvent event) {
|
||||
return (event.getSource() & InputDevice.SOURCE_MOUSE_RELATIVE) != 0;
|
||||
return event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,11 +33,13 @@ public class AndroidPointerIconCaptureProvider extends InputCaptureProvider {
|
||||
|
||||
@Override
|
||||
public void enableCapture() {
|
||||
super.enableCapture();
|
||||
setPointerIconOnAllViews(PointerIcon.getSystemIcon(context, PointerIcon.TYPE_NULL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCapture() {
|
||||
super.disableCapture();
|
||||
setPointerIconOnAllViews(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,21 @@ package com.limelight.binding.input.capture;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
public abstract class InputCaptureProvider {
|
||||
public abstract void enableCapture();
|
||||
public abstract void disableCapture();
|
||||
protected boolean isCapturing;
|
||||
|
||||
public void enableCapture() {
|
||||
isCapturing = true;
|
||||
}
|
||||
public void disableCapture() {
|
||||
isCapturing = false;
|
||||
}
|
||||
|
||||
public void destroy() {}
|
||||
|
||||
public boolean isCapturing() {
|
||||
return isCapturing;
|
||||
}
|
||||
|
||||
public boolean eventHasRelativeMouseAxes(MotionEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
package com.limelight.binding.input.capture;
|
||||
|
||||
|
||||
public class NullCaptureProvider extends InputCaptureProvider {
|
||||
@Override
|
||||
public void enableCapture() {}
|
||||
|
||||
@Override
|
||||
public void disableCapture() {}
|
||||
}
|
||||
public class NullCaptureProvider extends InputCaptureProvider {}
|
||||
|
||||
@@ -63,11 +63,13 @@ public class ShieldCaptureProvider extends InputCaptureProvider {
|
||||
|
||||
@Override
|
||||
public void enableCapture() {
|
||||
super.enableCapture();
|
||||
setCursorVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCapture() {
|
||||
super.disableCapture();
|
||||
setCursorVisibility(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
|
||||
@Override
|
||||
public void enableCapture() {
|
||||
super.enableCapture();
|
||||
if (!started) {
|
||||
// Start the handler thread if it's our first time
|
||||
// capturing
|
||||
@@ -247,6 +248,7 @@ public class EvdevCaptureProvider extends InputCaptureProvider {
|
||||
|
||||
@Override
|
||||
public void disableCapture() {
|
||||
super.disableCapture();
|
||||
// This may be called on the main thread
|
||||
runInNetworkSafeContextSynchronously(new Runnable() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user