Move input capture check to not mask touch events

This commit is contained in:
Cameron Gutman 2017-06-02 18:17:18 -07:00
parent a413185085
commit 90a1e68c68

View File

@ -688,11 +688,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
else if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0 || else if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0 ||
event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE) event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE)
{ {
// Ignore mouse input if we're not capturing from our input source
if (!inputCaptureProvider.isCapturing()) {
return false;
}
// This case is for mice // This case is for mice
if (event.getSource() == InputDevice.SOURCE_MOUSE || if (event.getSource() == InputDevice.SOURCE_MOUSE ||
(event.getPointerCount() >= 1 && (event.getPointerCount() >= 1 &&
@ -700,6 +695,11 @@ public class Game extends Activity implements SurfaceHolder.Callback,
{ {
int changedButtons = event.getButtonState() ^ lastButtonState; int changedButtons = event.getButtonState() ^ lastButtonState;
// Ignore mouse input if we're not capturing from our input source
if (!inputCaptureProvider.isCapturing()) {
return false;
}
if (event.getActionMasked() == MotionEvent.ACTION_SCROLL) { if (event.getActionMasked() == MotionEvent.ACTION_SCROLL) {
// Send the vertical scroll packet // Send the vertical scroll packet
byte vScrollClicks = (byte) event.getAxisValue(MotionEvent.AXIS_VSCROLL); byte vScrollClicks = (byte) event.getAxisValue(MotionEvent.AXIS_VSCROLL);