From ec4721c5b81ca39355f660294bf45edc0a1584da Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 27 Mar 2019 18:53:27 +0100 Subject: Bug 1348: Fix X11 XI Multitouch I got access to a touchscreen laptop w/ Debian 9, hence I could fix and test the implementation. X11 DisplayDriver.java: - Store and pass through xi_opcode of XI extension, queried at initialization stage X11Window.c Fixes: - Initialize JavaWindow's xiTouchCoords[].id w/ -1, as required to track the pointer - Pass through xi_opcode as stored in X11 DisplayDriver X11Display.c Fixes: - sendTouchScreenEvent: Throw RuntimeException if 0 > actionId (Internal Error: based on xiTouchCoords[].id tracking) - DispatchMessages's windowPointer determination: -- Query potenial XI Event first: IF XI Event, must use XIDeviceEvent's event Window -- Only IF not an XI Event, we can use evt.xany.window as the event window - DispatchMessages's XI Event Handling: -- Always break deviceid search loop if id found, preserving index and time spend Works on my Debian 9 device, tested w/ com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT: - One pointer (finger) press, drag and release (click) - PinchToZoomGesture works - DoubleTabScrollGesture works +++ Potential Issues: JavaWindow's xiTouchCoords[].id accuracy is crucial to pointer tracking during XI_TouchBegin -> XI_TouchUpdate -> XI_TouchEnd. In the normal course of action: - XI_TouchBegin sets the id, assuming it is yet set - XI_TouchUpdate assumes it is set - XI_TouchEnd clears the id, assuming it is set This field in the JavaWindow array only gets reset to -1 once at native window creation. We may need to figure out when to reset this field to -1. If the XI_TouchEnd events would get lost for whatever reason, the above tracking state would be broken. --- src/newt/native/X11Common.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/newt/native/X11Common.h') diff --git a/src/newt/native/X11Common.h b/src/newt/native/X11Common.h index 99795b6e8..978cfffed 100644 --- a/src/newt/native/X11Common.h +++ b/src/newt/native/X11Common.h @@ -94,7 +94,6 @@ typedef struct { Bool maxVert; /** flag whether window is mapped */ Bool isMapped; - int xiOpcode; int xiTouchDeviceId; XITouchPosition xiTouchCoords[XI_TOUCHCOORD_COUNT]; } JavaWindow; -- cgit v1.2.3