Bug 1311 - Multi touch drag events being discarded incorrectly in WindowImpl
Summary: Multi touch drag events being discarded incorrectly in WindowImpl
Status: CONFIRMED
Alias: None
Product: Newt
Classification: JogAmp
Component: core (show other bugs)
Version: 2.4.1
Hardware: embedded_arm linux
: P4 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2016-06-01 21:41 CEST by Phil Jordan
Modified: 2020-01-05 01:06 CET (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Jordan 2016-06-01 21:41:18 CEST
On android (HTC m8 with marshmallow) when doing multi touch input on a GLWindow, the drag events of the second touch are not being delivered to mouse listeners.

Turning on mouse debug I get the output below, to which I have added commentary about what I believe is happening at each point.



 Output from a single left touch and hold then 2 right swipes


<First press on lower left, notice xy = 495/746 of pixel[1920x1080]>
<This event is delivered to listener>
06-01 16:42:39.185 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_PRESSED, mod 0, pos 495/746, button 1, lastMousePosition: 0 / 0, PState1[inside true, exitSent false, lastPress 1464792128269, pressed [button 0, mask 0, dragging false, clickCount 1]
06-01 16:42:39.200 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_PRESSED, [495]/[746], button 1, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<1>[0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792159185 d 15ms]]], PState0[inside true, exitSent false, lastPress 1464792128269, dragging false], pos 495/746, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:39.200 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_PRESSED, [495]/[746], button 1, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<1>[0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792159185 d 15ms]]], PState0[inside true, exitSent false, lastPress 1464792159185, dragging false]

<Dragged on lower left as well (touch is a bit shakey)>
<This event is delivered to listener>
06-01 16:42:40.107 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_DRAGGED, mod 0, pos 495/746, button 1, lastMousePosition: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 32, dragging false, clickCount 1]
06-01 16:42:40.113 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_DRAGGED, [495]/[746], button 1, count 0, rotation [0.0, 0.0, 0.0] * 24.0, pointer<1>[0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160107 d 6ms]]], PState0[inside true, exitSent false, lastPress 1464792159185, dragging false], pos 495/746, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:40.113 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_DRAGGED, [495]/[746], button 1, count 0, rotation [0.0, 0.0, 0.0] * 24.0, pointer<1>[0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160107 d 6ms]]], PState0[inside true, exitSent false, lastPress 1464792159185, dragging true]


<touch on lower right pos 1370/780>
06-01 16:42:40.141 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_PRESSED, mod 0, pos 1370/780, button 2, lastMousePosition: 0 / 0, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 32, dragging true, clickCount 1]
06-01 16:42:40.145 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_PRESSED, [1370, 495]/[780, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1370/780, p[0.33333334/0.7=0.4761905], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160140 d 5ms]]], PState0[inside true, exitSent false, lastPress 1464792159185, dragging true], pos 1370/780, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:40.145 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_PRESSED, [1370, 495]/[780, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1370/780, p[0.33333334/0.7=0.4761905], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160140 d 5ms]]], PState0[inside true, exitSent false, lastPress 1464792159185, dragging true]

<lower right drag being discarded as having the same location as lowere left first touch!>
06-01 16:42:40.174 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:40.214 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:40.266 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:40.390 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]

<lower right drag being released>
06-01 16:42:40.429 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_RELEASED, mod 0, pos 1733/764, button 2, lastMousePosition: 0 / 0, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:40.432 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_RELEASED, [1733, 495]/[764, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1733/764, p[0.3/0.7=0.42857146], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160429 d 3ms]]], PState0[inside true, exitSent false, lastPress 1464792159185, dragging true], pos 1733/764, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:40.432 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_RELEASED, [1733, 495]/[764, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1733/764, p[0.3/0.7=0.42857146], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160429 d 3ms]]], PState0[inside true, exitSent false, lastPress 0, dragging true]


<not sure where these come from, perhaps lower left is a bit shaky again>
06-01 16:42:40.463 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 32, dragging true, clickCount 1]
06-01 16:42:40.846 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 32, dragging true, clickCount 1]


<lower right drag again, press event for start>
<notice also that 0/TouchScreen refers to first (still held) touch>
06-01 16:42:40.880 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_PRESSED, mod 0, pos 1336/794, button 2, lastMousePosition: 0 / 0, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 32, dragging true, clickCount 1]
06-01 16:42:40.881 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_PRESSED, [1336, 495]/[794, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1336/794, p[0.3/0.7=0.42857146], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160880 d 1ms]]], PState0[inside true, exitSent false, lastPress 0, dragging true], pos 1336/794, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:40.882 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_PRESSED, [1336, 495]/[794, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1336/794, p[0.3/0.7=0.42857146], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792160880 d 2ms]]], PState0[inside true, exitSent false, lastPress 0, dragging true]

<drags discarded incorrectly again on lower right>
06-01 16:42:40.937 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:40.988 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:41.038 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:41.089 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:41.123 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: drop EVENT_MOUSE_DRAGGED w/ same position: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]


<second lower right drag released>
06-01 16:42:41.180 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_RELEASED, mod 0, pos 1822/732, button 2, lastMousePosition: 0 / 0, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 96, dragging true, clickCount 1]
06-01 16:42:41.189 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_RELEASED, [1822, 495]/[732, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1822/732, p[0.3/0.7=0.42857146], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792161179 d 10ms]]], PState0[inside true, exitSent false, lastPress 0, dragging true], pos 1822/732, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:41.189 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_RELEASED, [1822, 495]/[732, 746], button 2, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<2>[1/TouchScreen: 1822/732, p[0.3/0.7=0.42857146], 0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1, button2], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792161179 d 10ms]]], PState0[inside true, exitSent false, lastPress 0, dragging true]

<first lower left touch released>
06-01 16:42:41.554 29636-29636/com.ingenieur.ese.eseandroid W/syserr: doPointerEvent: enqueue true, wait false, EVENT_MOUSE_RELEASED, mod 0, pos 495/746, button 1, lastMousePosition: 495 / 746, PState1[inside true, exitSent false, lastPress 1464792159185, pressed [button 1, mask 32, dragging true, clickCount 1]
06-01 16:42:41.555 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.in: MouseEvent[EVENT_MOUSE_RELEASED, [495]/[746], button 1, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<1>[0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792161554 d 1ms]]], PState0[inside true, exitSent false, lastPress 0, dragging true], pos 495/746, win[0/0 1920x1080], pixel[1920x1080]
06-01 16:42:41.556 29636-30078/com.ingenieur.ese.eseandroid W/syserr: consumePointerEvent.send.1: MouseEvent[EVENT_MOUSE_RELEASED, [495]/[746], button 1, count 1, rotation [0.0, 0.0, 0.0] * 24.0, pointer<1>[0/TouchScreen: 495/746, p[0.3/0.7=0.42857146]], InputEvent[modifiers: [button1], NEWTEvent[source:jogamp.newt.driver.android.WindowDriver, consumed false, when:1464792161554 d 2ms]]], PState0[inside true, exitSent false, lastPress 0, dragging false]
 

I notice drags at lower right always get returned


I feel the source of the problem is in WindowsImpl at line 3639, 
 case MouseEvent.EVENT_MOUSE_DRAGGED:
                if( null != movePositionP0 ) {
                    if( movePositionP0.getX() == x && movePositionP0.getY() == y ) {
                        // Drop same position
                        if(DEBUG_MOUSE_EVENT) {
                            System.err.println("doPointerEvent: drop "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0+", "+pState1);
                        }
                        return;
                    }
                    movePositionP0.set(x, y);
                }


somehow it is matching the first press location with the new drag location and they are being equal when they should not be, 
perhaps the reorder for triggering event is doing something wrong.
If I remove these lines from the class then all the drag events come through fine, so that is my work around.
Comment 1 Sven Gothel 2019-03-30 05:04:20 CET
Thank you Phil for your excellent description and analysis.

I see that the debug info is not sufficient sadly,
but as you figured - the 2nd pointer DRAG on the right-lower 
shows the left-lower position of the 1st pointer.
This is wrong.

What could cause it? Maybe the pID used based on actionIdx is wrong?
Or the actionIdx itself ..

Need to investigate this.