Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Touchscreen controlling doesn't work at some devices when using SDL_GetTouchFinger() calling by touch IDs #5322

Closed
Wohlstand opened this issue Feb 6, 2022 · 56 comments

Comments

@Wohlstand
Copy link
Contributor

Hello!

Recently I found that some users has problem that touchscreen doesn't work for them.
Later, by my log file, I found that SDL_GetNumTouchDevices() got returned two touch screen devices, and seems, one of them is a ghost tha steals control and makes no way to use the real one. At my phone the touch control works fine, however, I suddely found it returns !!!6!!! touch devices 😱

(Note, to choose the device to work, I do scan all devices to find any that has fingers placed)

  • My phone is SGN9 with Android 10
  • My buddy's phone is another Samsung phone with Android 11
  • Other folk used Xiaomi with Android 11 and had the similar problem of touch screen not working.
  • I use SDL 2.0.18, but plan to update into 2.0.20.
  • All returned touch devices described as direct input

Was this bug been fixed at 2.0.20? Why these mystery touch devices got appear here?

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

strange, and what are the name of the touch devices ?
(you can add some trace in src/event/SDL_touch.c , SDL_AddTouch)

@Wohlstand
Copy link
Contributor Author

Okay, I see:

[mouse_input]
[sec_touchpad]
[sec_e-pen]
[sec_e-pen-pad]
[sec_touchscreen]
[sec_virtual-e-pen]

@Wohlstand
Copy link
Contributor Author

I expected the touch device will return most of the touchscreen, but looks like it adds even more things, including S-Pen as independent touch device 🤔

@Wohlstand
Copy link
Contributor Author

At the Java side I have the next code that adds touch devices:

    public static void initTouch() {
        int[] ids = InputDevice.getDeviceIds();

        for (int id : ids) {
            InputDevice device = InputDevice.getDevice(id);
            if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) {
                nativeAddTouch(device.getId(), device.getName());
            }
        }
    }

but looks like it adds all of them than filter touchscreen only....

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

I remember I saw previously errors with this code. See: #2718

For instance, an USB Mouse device get added as SDL_Touch device, which is wrong.

It seemed to me there was errors in using SOURCE_* vs SOURCE_CLASS_* types.
some are 1-bit, other are set of 1-bit

In android java class InputDevice, there are constants named SOURCE_CLASS_something and SOURCE_something.
It describres input devices that can be connected like touchscreen, mouse, joystick and so on.
See https://developer.android.com/reference/android/view/InputDevice.html

A "SOURCE_something" can belong to a "SOURCE_CLASS_something".
(it can be 0 class, like SOURCE_TOUCH_NAVIGATION or SOURCE_ROTARY_ENCODE who have no class, all others are 1. But we even could consider a source can belong to N class).
Anyway, per CLASS, they are potentially several SOURCE_something.

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

@Wohlstand

  • All those touch are added as TOUCH_DIRECT, but maybe some should be TOUCH_INDIRECT.
  • The Touch device, can be added either from the java side you pointed, but also from the C side (src/video/android/SDL_androidtouch.c) (we may someting bad)

Can you add some trace in the java file, so that:
we can see which are added from java ?
you can copy the function "debugSource(int s, String prefix)" from (#2718 patch )
to trace the name + input type (device.getSources()) so that we can see what kind of device they represents ?
(keep a trace in SDL_AddTouch() to see all that are added)

@Wohlstand
Copy link
Contributor Author

Okay so, a first 5 devices it adds on launch from the Java side, and then, on every touch event, it adds one another device from C side:

2022-02-07 19:07:19.071 28251-31475/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147471101 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE TOUCHSCREEN
2022-02-07 19:07:19.071 28251-31475/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147462909 CLASS={ BUTTON POINTER } source(s): KEYBOARD STYLUS TOUCHSCREEN
2022-02-07 19:07:19.072 28251-31475/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=8451 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE
2022-02-07 19:07:19.073 28251-31475/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147479293 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
2022-02-07 19:07:19.075 28251-31475/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147458813 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE STYLUS
2022-02-07 19:07:23.374 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:23.440 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:23.455 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:23.456 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:27.405 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:27.427 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:27.478 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:27.494 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:07:27.497 28251-28251/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6

@Wohlstand
Copy link
Contributor Author

btw, When I replace condition:

device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0

with

device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN

Now it adds three devices only at Java side:

2022-02-07 19:17:38.269 30766-4444/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147471101 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE TOUCHSCREEN
2022-02-07 19:17:38.270 30766-4444/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147462909 CLASS={ BUTTON POINTER } source(s): KEYBOARD STYLUS TOUCHSCREEN
2022-02-07 19:17:38.271 30766-4444/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch value=-2147479293 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
2022-02-07 19:17:46.202 30766-30766/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:17:46.218 30766-30766/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

@Wohlstand

Can you add the "name" for the java trace.
And also and the "name" in the C side.
Place the the trace in SDL_AddTouch() at the end of the function.
(the first part of the function doesn't really add the touch but returns).

@Wohlstand
Copy link
Contributor Author

And also and the "name" in the C side.

For C code it just adds constant empty line "", for Java side yes, wait some

@Wohlstand
Copy link
Contributor Author

2022-02-07 19:30:19.740 8374-10273/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch (sec_touchpad) value=-2147471101 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE TOUCHSCREEN
2022-02-07 19:30:19.741 8374-10273/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch (sec_e-pen) value=-2147462909 CLASS={ BUTTON POINTER } source(s): KEYBOARD STYLUS TOUCHSCREEN
2022-02-07 19:30:19.742 8374-10273/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch (sec_touchscreen) value=-2147479293 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
2022-02-07 19:30:25.836 8374-8374/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:30:25.870 8374-8374/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6
2022-02-07 19:30:25.900 8374-8374/ru.wohlsoft.thextech.debug I/SDL/APP: C-side add touch call: 6

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

ok, some more check:

  • can you set back the original java line (you said you replace condition device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0 (
  • can you also add the trace before the "if" java nativeaddtouch(). so we also see the trace for all "ids".

@Wohlstand
Copy link
Contributor Author

Done:

  • "touch id" calls before if
  • "add touch id" calls inside
2022-02-07 19:59:58.060 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [-1] (Virtual) value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
2022-02-07 19:59:58.060 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [1] (certify_hall) value=-2147483648 CLASS={ } source(s): FLAG_TAINTED
2022-02-07 19:59:58.060 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [3] (sec_touchpad) value=-2147471101 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE TOUCHSCREEN
2022-02-07 19:59:58.061 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch id [3] (sec_touchpad) value=-2147471101 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE TOUCHSCREEN
2022-02-07 19:59:58.061 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [4] (sec_e-pen) value=-2147462909 CLASS={ BUTTON POINTER } source(s): KEYBOARD STYLUS TOUCHSCREEN
2022-02-07 19:59:58.061 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch id [4] (sec_e-pen) value=-2147462909 CLASS={ BUTTON POINTER } source(s): KEYBOARD STYLUS TOUCHSCREEN
2022-02-07 19:59:58.062 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [5] (sec_e-pen-pad) value=8451 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE
2022-02-07 19:59:58.062 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch id [5] (sec_e-pen-pad) value=8451 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE
2022-02-07 19:59:58.063 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [6] (sec_touchscreen) value=-2147479293 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
2022-02-07 19:59:58.063 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch id [6] (sec_touchscreen) value=-2147479293 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
2022-02-07 19:59:58.063 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [7] (sec_virtual-e-pen) value=-2147458813 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE STYLUS
2022-02-07 19:59:58.063 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side add touch id [7] (sec_virtual-e-pen) value=-2147458813 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE STYLUS
2022-02-07 19:59:58.064 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [8] (Headset) value=-2147483391 CLASS={ BUTTON } source(s): KEYBOARD
2022-02-07 19:59:58.065 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [9] (gpio_keys) value=257 CLASS={ BUTTON } source(s): KEYBOARD
2022-02-07 19:59:58.065 29186-30921/ru.wohlsoft.thextech.debug V/SDL: Java-side touch id [10] (hall) value=-2147483648 CLASS={ } source(s): FLAG_TAINTED

@Wohlstand
Copy link
Contributor Author

And the device 6 is actual touchscreen that is used at me

@Wohlstand
Copy link
Contributor Author

(so, C-side had simply request the existing touch device)

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

Ok Great !
So we call SDL_AddTouch(), for those ones:

 id [3] (sec_touchpad) value=-2147471101 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE TOUCHSCREEN
 id [4] (sec_e-pen) value=-2147462909 CLASS={ BUTTON POINTER } source(s): KEYBOARD STYLUS TOUCHSCREEN
 id [5] (sec_e-pen-pad) value=8451 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE
 id [6] (sec_touchscreen) value=-2147479293 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
 id [7] (sec_virtual-e-pen) value=-2147458813 CLASS={ BUTTON POINTER } source(s): KEYBOARD MOUSE STYLUS

the java code that does it is:

            if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) {
                nativeAddTouch(device.getId(), device.getName());
            }

The layout of the 'sources' is
mask for sources: ff ff ff 00
mask for classes: 00 00 00 ff

InputDevice.SOURCE_TOUCHSCREEN is defined as 0x00001002
Eg: source 0x1000 + class 0x2 (source_class_pointer).
https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCHSCREEN

So the id[5] isn't selected because it's a "TOUCHSCREEN" but because it is a MOUSE, and the MOUSE is a CLASS_POINTER, like the TOUCHSCREEN is a CLASS_POINTER.

@Wohlstand can you explain how it breaks you app ?

@slouken ?
not sure what we should do ?
simply change to:

device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN

So we select devices who have at least a SOURCE_TOUCHSCREEN inside ?

Also some are "stylus" should they be SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE/RELATIVE ? (they are currently all SDL_TOUCH_DEVICE_DIRECT) ?

@Wohlstand
Copy link
Contributor Author

The stylus is a direct input device, and it works over the main device. (in my case it's an S-Pen stylus)

I guess, everything that doesn't contain a "touchscreen" shouldn't be added here. Anyway, SDL2 seems to need an extra description of touch device types to tell, what is it: touchscreen, or the side-plugged touchpad thing.

@Wohlstand
Copy link
Contributor Author

So we select devices who have at least a SOURCE_TOUCHSCREEN inside ?

Right now yes, as the touchscreen is used mainly on Android devices (but possibly, some special embedded devices would have the non-screen touchpad or something also that would be cool to utilize).

@1bsyl
Copy link
Contributor

1bsyl commented Feb 7, 2022

I think this is a typo. because the first shot was to filter with SOURCE_TOUCHSCREEN
SDL-mirror/SDL@f50e84c

The adding of touch devices after a touch event was received is still active to allow connecting

Wohlstand added a commit to Wohlstand/TheXTech that referenced this issue Feb 7, 2022
@Wohlstand
Copy link
Contributor Author

Wohlstand commented Feb 7, 2022

I'll send a test build to my buddy (who has troubles with a touchscreen controller: it just doesn't work at all at his end), and will say, had they solved the problem or not...

@Wohlstand
Copy link
Contributor Author

@1bsyl, just now I found another case, I finally sent a debug build to my buddy, and what his device reported:

Devices got been added to the list of touch devices:

device available name=[Virtual] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
device available name=[sec_touchscreen] id=2 value=4355 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
-- touch added name=[sec_touchscreen] id=2 value=4355 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
device available name=[mtk-kpd] id=3 value=257 CLASS={ BUTTON } source(s): KEYBOARD
device available name=[ACCDET] id=4 value=-2147483391 CLASS={ BUTTON } source(s): KEYBOARD

The device with id=2 got been added to the list

Devices got been retrieved using SDL API:

Debug: Touch device 0 (id=-1): Direct touch type
Debug: Touch device 1 (id=2): Direct touch type

And.... 🥁 🥁 🥁 🥁 🥁 🥁 ... What touch device ID SDL events reports as modified:

Debug: Touch finger down at device -2
Debug: Touch finger up at device -2

So, because of this weird case, buddy has touchscreen controller don't work at all 🤔

@Wohlstand
Copy link
Contributor Author

P.S. Forgot to tell you that I updated my SDL2 up to 2.0.20

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

@Wohlstand

ok ... in SDLActivity.java, we do:

1939         /*
1940          * Prevent id to be -1, since it's used in SDL internal for synthetic events
1941          * Appears when using Android emulator, eg:
1942          *  adb shell input mouse tap 100 100
1943          *  adb shell input touchscreen tap 100 100
1944          */
1945         if (touchDevId < 0) {
1946             touchDevId -= 1;
1947         }

So you should also do that in initTouch():

diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index 812163ca3..173fcb061 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -1205,7 +1205,17 @@ 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) {
-                nativeAddTouch(device.getId(), device.getName());
+                int touchDevId = device.getId();
+                /*
+                 * Prevent id to be -1, since it's used in SDL internal for synthetic events
+                 * Appears when using Android emulator, eg:
+                 *  adb shell input mouse tap 100 100
+                 *  adb shell input touchscreen tap 100 100
+                 */
+                if (touchDevId < 0) {
+                    touchDevId -= 1;
+                }
+                nativeAddTouch(touchDevId, device.getName());
             }
         }
     }

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

But the -1 is
device available name=[Virtual] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
which isn't a touchscreen ...

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

Can you log again in SDLActivity.java
2059 public boolean onTouch(View v, MotionEvent event) {

At the beginning of the function
do the same kind of traces for device with:
device.getId(), device.getName()

  • displays sources & classes with my prior function

@Wohlstand
Copy link
Contributor Author

Wohlstand commented Feb 8, 2022

But the -1 is
device available name=[Virtual] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
which isn't a touchscreen ...

However, finger events from SDL_PollEvents came from -2 touch device, but actual touch device is 2

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

@Wohlstand:
there is no real -2 device. it's the -1, but we can't use this id, because it's also an SDL internal for syntethic event. so we decrement it, and it becomes -2.

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

Thanks, I got the "epos". had to use my translator .. At first, I though that was a hw device :)
So it's real touchscreen, but it's not reported at init. It's strange the the device used is "virtual" and not "sec_touchscreen".
Still curious about the traces in onTouch() that would produce the event.

@Wohlstand
Copy link
Contributor Author

Wohlstand commented Feb 8, 2022

I will try to make some tweaks after I'll complete my today's main job and will send another debug build to my buddy (there is some waiting that will be needed as he lives with 7 hours later than me (my time zone is UTC+3), and he is asleep now)

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

thanks !

@1bsyl
Copy link
Contributor

1bsyl commented Feb 8, 2022

for the record:
using intput_keyboard: SDL-mirror/SDL@515ee99
using input_mouse: SDL-mirror/SDL@d880e95

1bsyl added a commit that referenced this issue Feb 8, 2022
1bsyl added a commit that referenced this issue Feb 8, 2022
Wohlstand added a commit to Wohlstand/TheXTech that referenced this issue Feb 8, 2022
- every onTouch() event happening
- Set SDL hints to disable mouse<->touch event mapping

libsdl-org/SDL#5322
@Wohlstand
Copy link
Contributor Author

Okay, I did some tweaks at my side and made another debug build for my buddy, will wait tomorrow once he wakes up and gives us another log file with the result

@Wohlstand
Copy link
Contributor Author

Wohlstand commented Feb 9, 2022

Okay, my buddy finally tested my debug build with onTouch() trace and both mouse-touch mapper hints disabled, so, result is next:

Load trace:

Debug: Java-Side: device available name=[Virtual] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: touch added name=[Virtual] id=-2 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: device available name=[sec_touchscreen] id=2 value=4355 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
Debug: Java-Side: touch added name=[sec_touchscreen] id=2 value=4355 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
Debug: Java-Side: device available name=[mtk-kpd] id=3 value=257 CLASS={ BUTTON } source(s): KEYBOARD
Debug: Java-Side: device available name=[ACCDET] id=4 value=-2147483391 CLASS={ BUTTON } source(s): KEYBOARD

SDL API touch devices:

Debug: Found 2 touch devices, screen size: 2321 x 1080
Debug: Touch device 0 (id=-2): Direct touch type
Debug: Touch device 1 (id=2): Direct touch type
Debug: Totally loaded valid touch devices: 2

Touch poll events mixed with Java side trace:

Debug: Just activated new Touchscreen 'Touchscreen' with profile 'Touchscreen 1'.
Debug: = Finger press: ID=0, X=0.2934, Y=0.2981, P=0.0059
Debug: = Finger press: ID=0, X=0.2934, Y=0.2981, P=0.0059
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.2934, Y=0.2981, P=0.0056
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.2930, Y=0.2981, P=0.0017
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger up at device -2
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/npc//npc-265.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/toad/toad-7.png)
Warning: Texture can't be shrank: Pixel colors at the 6 x 4 sector (2x2 square) aren't equal (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-10.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3253, Y=0.5000, P=0.0054
Debug: Touch finger down at device -2
Debug: = Finger press: ID=0, X=0.3253, Y=0.5000, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3253, Y=0.5012, P=0.0056
Debug: = Finger press: ID=0, X=0.3253, Y=0.5012, P=0.0056
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3253, Y=0.5012, P=0.0056
Debug: = Finger press: ID=0, X=0.3253, Y=0.5012, P=0.0056
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3253, Y=0.5048, P=0.0051
Debug: = Finger press: ID=0, X=0.3253, Y=0.5048, P=0.0051
Debug: = Finger press: ID=0, X=0.3253, Y=0.5048, P=0.0051
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3257, Y=0.5303, P=0.0056
Debug: = Finger press: ID=0, X=0.3257, Y=0.5303, P=0.0056
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3269, Y=0.5658, P=0.0054
Debug: = Finger press: ID=0, X=0.3269, Y=0.5658, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3296, Y=0.6026, P=0.0046
Warning: Texture can't be shrank: Pixel colors at the 2 x 8 sector (2x2 square) aren't equal (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-139.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-131.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3326, Y=0.6351, P=0.0049
Debug: = Finger press: ID=0, X=0.3326, Y=0.6351, P=0.0049
Debug: = Finger press: ID=0, X=0.3326, Y=0.6351, P=0.0049
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3332, Y=0.6613, P=0.0044
Debug: = Finger press: ID=0, X=0.3332, Y=0.6613, P=0.0044
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3324, Y=0.6803, P=0.0051
Debug: = Finger press: ID=0, X=0.3324, Y=0.6803, P=0.0051
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3316, Y=0.6946, P=0.0054
Debug: = Finger press: ID=0, X=0.3316, Y=0.6946, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3313, Y=0.7000, P=0.0051
Debug: = Finger press: ID=0, X=0.3313, Y=0.7000, P=0.0051
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3309, Y=0.7029, P=0.0044
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-78.png)
Debug: = Finger press: ID=0, X=0.3309, Y=0.7029, P=0.0044
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3309, Y=0.7029, P=0.0044
Debug: = Finger press: ID=0, X=0.3309, Y=0.7095, P=0.0037
Debug: = Finger press: ID=0, X=0.3309, Y=0.7095, P=0.0037
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3317, Y=0.7182, P=0.0032
Debug: = Finger press: ID=0, X=0.3317, Y=0.7182, P=0.0032
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.3324, Y=0.7241, P=0.0012
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger up at device -2
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-75.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-127.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/block//block-90.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-63.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger down at device -2
Debug: = Finger press: ID=0, X=0.4489, Y=0.7287, P=0.0046
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/block//block-88.png)
Debug: = Finger press: ID=0, X=0.4489, Y=0.7287, P=0.0046
Debug: = Finger press: ID=0, X=0.4489, Y=0.7287, P=0.0046
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/npc//npc-274.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4489, Y=0.7296, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger up at device -2
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/block//block-164.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger down at device -2
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0046
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0046
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: = Finger press: ID=0, X=0.4485, Y=0.7380, P=0.0054
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4479, Y=0.7389, P=0.0061
Debug: = Finger press: ID=0, X=0.4479, Y=0.7389, P=0.0061
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4481, Y=0.7400, P=0.0027
Debug: = Finger press: ID=0, X=0.4481, Y=0.7400, P=0.0027
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.4481, Y=0.7426, P=0.0015
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger up at device -2
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Touch finger down at device -2

Little note: " = Finger press..." events are traces of fingers, and ID of each finger is, I'd clean up this log, but it's pain to do by phone, I'm not at home right now

1bsyl added a commit that referenced this issue Feb 9, 2022
…because

they can send SOURCE_TOUCHSCREEN events even if getSources() doesn't declare them.
@1bsyl
Copy link
Contributor

1bsyl commented Feb 9, 2022

@Wohlstand
The log is ok thanks !
Ok so the virtual device isn't declared as a TOUCHSCREEN, but the events are.
So let just declare it to SDL in the initTouch(), (like you did in your previous patch), but use isVirtual().

btw, notice the previous SDLControllerManager.java changes is different than yours)

@1bsyl
Copy link
Contributor

1bsyl commented Feb 9, 2022

eventually to get more information, you could also log in onTouch to see the "sources" of the inputdevice of the event.
to see, it if match what was on initTouch or not.

{
   InputDevice device = InputDevice.getDevice(event.getDeviceId());
   int sources = device.getSources();
   //log what "sources" look like
}

@Wohlstand
Copy link
Contributor Author

btw, notice the previous SDLControllerManager.java changes is different than yours)

Don't worry, I'll put the change manually 😉

1bsyl added a commit that referenced this issue Feb 9, 2022
@Wohlstand
Copy link
Contributor Author

(mainly, mine is different because I had to inject lots of logging)

Wohlstand added a commit to Wohlstand/TheXTech that referenced this issue Feb 9, 2022
- Using "isVirtual" instead of -1
- More debug logging against the touch device input

libsdl-org/SDL#5322
@Wohlstand
Copy link
Contributor Author

Made, so, gonna send the debug build to my buddy again

@Wohlstand
Copy link
Contributor Author

Aaaaand, another updated log:

Load:

Debug: Java-Side: device available name=[Virtual] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: touch added name=[Virtual] id=-2 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: device available name=[sec_touchscreen] id=2 value=4355 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
Debug: Java-Side: touch added name=[sec_touchscreen] id=2 value=4355 CLASS={ BUTTON POINTER } source(s): KEYBOARD TOUCHSCREEN
Debug: Java-Side: device available name=[mtk-kpd] id=3 value=257 CLASS={ BUTTON } source(s): KEYBOARD
Debug: Java-Side: device available name=[ACCDET] id=4 value=-2147483391 CLASS={ BUTTON } source(s): KEYBOARD

SDL API load:

Debug: Found 2 touch devices, screen size: 2321 x 1080
Debug: Touch device 0 (id=-2): Direct touch type
Debug: Touch device 1 (id=2): Direct touch type
Debug: Totally loaded valid touch devices: 2

Touch events:

Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0049
Debug: Just activated new Touchscreen 'Touchscreen' with profile 'Touchscreen 1'.
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0049
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0049
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0049
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0049
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0046
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0046
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0046
Debug: = Finger press: ID=0, X=0.3365, Y=0.5935, P=0.0046
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger up at device -2
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/block//block-90.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-63.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/block//block-88.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/npc//npc-274.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/block//block-164.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger down at device -2
Debug: = Finger Key ID=15 pressed (put)
Debug: = Finger ID=0 came
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0046
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0044
Debug: = Finger Key ID=15 pressed (move)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.0207, Y=0.0778, P=0.0044
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger up at device -2
Debug: = Finger Key ID=15 released (take)
Debug: = Finger ID=0 has gone
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/npc//npc-170.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/npc//npc-283.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger down at device -2
Debug: = Finger Key ID=15 pressed (put)
Debug: = Finger ID=0 came
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0046
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0046
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0042
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0042
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0246, Y=0.0824, P=0.0042
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 released (take)
Debug: = Finger ID=0 has gone
Debug: Touch finger up at device -2
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (put)
Debug: = Finger ID=0 came
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0037
Debug: Touch finger down at device -2
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0037
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0037
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0042
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0042
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0042
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0042
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0042
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0366, Y=0.0676, P=0.0042
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger up at device -2
Debug: = Finger Key ID=15 released (take)
Debug: = Finger ID=0 has gone
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger down at device -2
Debug: = Finger Key ID=15 pressed (put)
Debug: = Finger ID=0 came
Debug: = Finger press: ID=0, X=0.0336, Y=0.0611, P=0.0034
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0611, P=0.0034
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0623, P=0.0037
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0623, P=0.0037
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0623, P=0.0037
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0623, P=0.0037
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0623, P=0.0037
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0336, Y=0.0623, P=0.0037
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger up at device -2
Debug: = Finger Key ID=15 released (take)
Debug: = Finger ID=0 has gone
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-82.png)
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/effect//effect-144.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger down at device -2
Debug: = Finger Key ID=15 pressed (put)
Debug: = Finger ID=0 came
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0032
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0032
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0032
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0034
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0034
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0034
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0034
Debug: Texture CAN be shrank (/storage/emulated/0/SMBX_(TheXTech_v1.3.5.3)/graphics/npc//npc-88.png)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0034
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0276, Y=0.0704, P=0.0034
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 released (take)
Debug: = Finger ID=0 has gone
Debug: Touch finger up at device -2
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Touch finger down at device -2
Debug: = Finger Key ID=15 pressed (put)
Debug: = Finger ID=0 came
Debug: = Finger press: ID=0, X=0.0254, Y=0.0583, P=0.0032
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0254, Y=0.0583, P=0.0032
Debug: = Finger Key ID=15 pressed (move)
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: = Finger press: ID=0, X=0.0254, Y=0.0583, P=0.0032
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0254, Y=0.0593, P=0.0034
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0254, Y=0.0593, P=0.0034
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0254, Y=0.0593, P=0.0034
Debug: = Finger Key ID=15 pressed (move)
Debug: = Finger press: ID=0, X=0.0254, Y=0.0593, P=0.0034
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: Java-Side: onTouch Event name=[touch-event] id=-2 value=4098 CLASS={ POINTER } source(s): TOUCHSCREEN
Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD
Debug: = Finger Key ID=15 released (take)
Debug: = Finger ID=0 has gone
Debug: Touch finger up at device -2

@1bsyl
Copy link
Contributor

1bsyl commented Feb 9, 2022

ok. So the InputDevice is still reported as a "DPAD KEYBOARD", even if it sends TOUCHSCREEN sourced events.
Thanks for the many logs :)

Debug: Java-Side: onTouch Input Device Event name=[touch-event-indev] id=-1 value=769 CLASS={ BUTTON } source(s): DPAD KEYBOARD

If you're ok, let's close the issue. we've added the check with isVirtual() to add the inputDevice so you can detect it as potential SDL_Touch. And it doesn't hurt even other part of the code

@1bsyl 1bsyl closed this as completed Feb 9, 2022
@Wohlstand
Copy link
Contributor Author

Wohlstand commented Feb 9, 2022

Yea, because the main problem - a touchscreen didn't worked at my buddy - has been solved, and possibly, solved at many other people who also reported me the "touch controls don't react" mystery. And, because we all cleaned all unonowledge against this whole thing, etc.

That was a nice cooperation, thank you very much :)

@Wohlstand Wohlstand changed the title Android: SDL_GetNumTouchDevices() returns 2 and more mystic touch devices Android: Touchscreen controlling doesn't work at some devices when using SDL_GetTouchFinger() calling by touch IDs Feb 9, 2022
giannoug pushed a commit to giannoug/SDL that referenced this issue Nov 13, 2022
giannoug pushed a commit to giannoug/SDL that referenced this issue Nov 13, 2022
giannoug pushed a commit to giannoug/SDL that referenced this issue Nov 13, 2022
…ch device because

they can send SOURCE_TOUCHSCREEN events even if getSources() doesn't declare them.
giannoug pushed a commit to giannoug/SDL that referenced this issue Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants