mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-28 16:00:58 +00:00
Prevent short-circuit evaluation from eating some of our touch event handling
This commit is contained in:
parent
58020174b1
commit
1c93a58223
@ -72,7 +72,7 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener,
|
||||
public boolean onTouchEvent(final MotionEvent ev) {
|
||||
boolean canReadToolType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||
|
||||
boolean retval = false;
|
||||
int numTouchesHandled = 0;
|
||||
for (int i = 0; i < ev.getPointerCount(); i++) {
|
||||
int pid = ev.getPointerId(i);
|
||||
int code = 0;
|
||||
@ -103,10 +103,11 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener,
|
||||
int tool = getToolType(ev, i);
|
||||
code |= tool << 10; // We use the Android tool type codes
|
||||
}
|
||||
retval = retval || NativeApp.touch(ev.getX(i), ev.getY(i), code, pid);
|
||||
// Can't use || due to short circuit evaluation
|
||||
numTouchesHandled += NativeApp.touch(ev.getX(i), ev.getY(i), code, pid) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
return numTouchesHandled > 0;
|
||||
}
|
||||
|
||||
// Sensor management
|
||||
|
Loading…
Reference in New Issue
Block a user