From b32541efc1bef773c4f1bbd06d0885ee79821865 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 27 Mar 2019 03:43:42 +0100 Subject: Bug 1348: X11 XI Multitouch: Refine commit 746383476aa449e9cab4a25df27be85b61aa074b Add more verbose DBG_PRINT - @ CreateWindow: extension, scanning device/class, registered deviceid - @ DispatchMessage: XI_TouchBegin, XI_TouchUpdate and XI_TouchEnd On my test machine w/o a touchscreen I correctly: - detected extension - detected no XITouchClass device, hence no deviceid registered X11: [CreateWindow]: XI: Window 0x6600016, Extension 131 X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[1/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[2/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[3/13].class[1/3]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[3/13].class[2/3]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[3/13].class[3/3]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[4/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[5/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[6/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[7/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[8/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[9/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[10/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[11/13].class[1/1]: type 0 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[1/7]: type 1 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[2/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[3/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[4/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[5/7]: type 2 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[6/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[12/13].class[7/7]: type 3 (is XITouchClass 0) X11: [CreateWindow]: XI: Scan Window 0x6600016, device[13/13].class[1/1]: type 0 (is XITouchClass 0) --- src/newt/native/X11Display.c | 7 +++++-- src/newt/native/X11Window.c | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/newt/native/X11Display.c b/src/newt/native/X11Display.c index 1f3388fff..981e3197f 100644 --- a/src/newt/native/X11Display.c +++ b/src/newt/native/X11Display.c @@ -529,9 +529,9 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessage // Here: https://www.x.org/wiki/Development/Documentation/Multitouch/ XIDeviceEvent *devev = cookie->data; if( devev->event != windowPointer ) { - DBG_PRINT( "X11: DispatchMessages.XI dpy %p, win %p, Event %d: Event Window %p not matching\n", (void*)dpy, (void*)windowPointer, (int)evt.type, (void*)devev->event); + DBG_PRINT( "X11: XI event - dpy %p, win %p, Event %d: Event Window %p not matching\n", (void*)dpy, (void*)windowPointer, (int)evt.type, (void*)devev->event); } else if( devev->deviceid != jw->xiTouchDeviceId) { - DBG_PRINT( "X11: DispatchMessages.XI dpy %p, win %p, Event %d: DeviceID not matching: Window %d, this %d\n", (void*)dpy, (void*)windowPointer, (int)evt.type, devev->deviceid, jw->xiTouchDeviceId); + DBG_PRINT( "X11: XI event - dpy %p, win %p, Event %d: DeviceID not matching: Window %d, this %d\n", (void*)dpy, (void*)windowPointer, (int)evt.type, devev->deviceid, jw->xiTouchDeviceId); } else { int i; switch (devev->evtype) { @@ -544,6 +544,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessage break; } } + DBG_PRINT( "X11: XI event - XI_TouchBegin Window %p, devid %d, touchid %d @ %d/%d\n", (void*)windowPointer, devev->deviceid, jw->xiTouchCoords[i].id, jw->xiTouchCoords[i].x, jw->xiTouchCoords[i].y); sendTouchScreenEvent(env, jw, EVENT_MOUSE_PRESSED, 0, devev->detail % 32767); break; @@ -554,10 +555,12 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessage jw->xiTouchCoords[i].y = devev->event_y; } } + DBG_PRINT( "X11: XI event - XI_TouchUpdate: Window %p, devid %d, touchid %d @ %d/%d\n", (void*)windowPointer, devev->deviceid, jw->xiTouchCoords[i].id, jw->xiTouchCoords[i].x, jw->xiTouchCoords[i].y); sendTouchScreenEvent(env, jw, EVENT_MOUSE_MOVED, 0, devev->detail % 32767); break; case XI_TouchEnd: + DBG_PRINT( "X11: XI event - XI_TouchEnd: Window %p, devid %d, touchid %d\n", (void*)windowPointer, devev->deviceid, jw->xiTouchCoords[i].id); sendTouchScreenEvent(env, jw, EVENT_MOUSE_RELEASED, 0, devev->detail % 32767); for (i = 0; i < XI_TOUCHCOORD_COUNT; i++) { if (jw->xiTouchCoords[i].id == devev->detail % 32767) { diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 8fb3ecbb9..f815ca41b 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -958,25 +958,28 @@ JNIEXPORT jlongArray JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CreateWind { int xi_opcode, event, error; + javaWindow->xiOpcode = -1; javaWindow->xiTouchDeviceId = -1; if( XQueryExtension(dpy, "XInputExtension", &xi_opcode, &event, &error) ) { XIDeviceInfo *di; - int devid = -1; int cnt = 0; javaWindow->xiOpcode = xi_opcode; + DBG_PRINT( "X11: [CreateWindow]: XI: Window %p, Extension %d\n", (void*)window, xi_opcode); di = XIQueryDevice(dpy, XIAllDevices, &cnt); if( NULL != di && 0 < cnt ) { - XIDeviceInfo *dev; + int devid = -1; int i, j; // find the 1st XITouchClass device available for (i = 0; i < cnt && -1 == devid; i ++) { - dev = &di[i]; + XIDeviceInfo *dev = &di[i]; for (j = 0; j < dev->num_classes; j ++) { XITouchClassInfo *class = (XITouchClassInfo*)(dev->classes[j]); + DBG_PRINT( "X11: [CreateWindow]: XI: Scan Window %p, device[%d/%d].class[%d/%d]: type %d (is XITouchClass %d)\n", + (void*)window, (i+1), cnt, (j+1), dev->num_classes, class->type, (XITouchClass == class->type)); if ( XITouchClass == class->type ) { devid = dev->deviceid; break; @@ -1003,6 +1006,7 @@ JNIEXPORT jlongArray JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CreateWind free(mask.mask); javaWindow->xiTouchDeviceId = devid; + DBG_PRINT( "X11: [CreateWindow]: XI: Window %p, XITouchClass devid %d\n", (void*)window, devid); } } } -- cgit v1.2.3