We recently choose to use Newt (instead of GLCanvas). And we want to have same fonctionnality and API (especially mouseEvent).
In order to do that, we get mouseEvent from GLWindow, create Awt event from them, and after we dispatch these Awt events to the component that we want.
It's working except the drag and drop : I want to drag and drop a shape from a GLWindow into this GLWindow (so I only want to move this shape into the GLWindow using drag and drop), and I can't because at the beginning of drag and drop, I have :
java.awt.dnd.InvalidDnDOperationException: Cannot grab pointer: already grabbed
at sun.awt.X11.XDragSourceContextPeer.throwGrabFailureException(XDragSourceContextPeer.java:297)
at sun.awt.X11.XDragSourceContextPeer.startDrag(XDragSourceContextPeer.java:206)
at sun.awt.dnd.SunDragSourceContextPeer.startDrag(SunDragSourceContextPeer.java:135)
at java.awt.dnd.DragSource.startDrag(DragSource.java:321)
at java.awt.dnd.DragSource.startDrag(DragSource.java:426)
at java.awt.dnd.DragGestureEvent.startDrag(DragGestureEvent.java:263)
I think it because the drag and drop system want to change the cursor. But I don't understand why I have these error : I don't grab the pointer before the drag.
Do you have an idea? Maybe Newt/GLWindow grab the pointer ? Maybe DnD is not compatible with Newt ?
I think the problem is just that a Newt component grab the pointer. I dont really need DnD support for Newt : I just need to know where the pointer is grabbed. I think it a Newt component but I'm not sure.
Do you have any idea ?
We get JOGL source code, and in order to don't have conflit on Event, try to desactivate Event for Newt.
So we keep event as usual, and we don't need to convert them.
Our modification : On X11Window.c on createWindow0, we add a boolean parameter (ignoreEvent) and if true, on xswa.event_mask, we don't put X11_MOUSE_EVENT_MASK and KeyPressMask and KeyReleaseMask.
It works for Dnd and it also bypass Newt mouse and key event. So we could keep our code without modifying all mouse and key function (it's better if we have thousands of code lines).
If I want to contribute to JOGL by pushing this code : how to do that ?
I'm not an expert on JOGL, so I don't know if it's my modification broke the code on other part of JOGL : how to know if it's correct for you ?
For now this modification is only for X11 : Windows and OSX is needeed ?