Fixed bug #5322 - register virtual input devices as SDL_Touch device because

they can send SOURCE_TOUCHSCREEN events even if getSources() doesn't declare them.
This commit is contained in:
Sylvain 2022-02-09 09:37:36 +01:00
parent 59f1e2875a
commit 3a9bbf604e
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
1 changed files with 4 additions and 1 deletions

View File

@ -1304,7 +1304,10 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
for (int id : ids) {
InputDevice device = InputDevice.getDevice(id);
if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) {
/* Allow SOURCE_TOUCHSCREEN and also Virtual InputDevices because they can send TOUCHSCREEN events */
if (device != null && ((device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN
|| device.isVirtual()) {
int touchDevId = device.getId();
/*
* Prevent id to be -1, since it's used in SDL internal for synthetic events