NEWT : Drag and Drop

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

NEWT : Drag and Drop

jeremyl
Hi All,

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 hope you can help me.

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

gouessej
Administrator
Hi

NEWT doesn't support drag and drop as far as I know, there is a request for enhancement about that:
https://jogamp.org/bugzilla/show_bug.cgi?id=1164
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

jeremyl
Thank you for your response.

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 ?

Jérémy
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

gouessej
Administrator
I suspect AWT grabs the pointer but I'm not sure. I don't see why NEWT would do it.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

jeremyl
Thank you

I will check it.
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

jeremyl
Hi,

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 ?

Jérémy
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

gouessej
Administrator
Please mention your change in the bug report I quoted but in my humble opinion, more changes will have to be done to make something consistent.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

jeremyl
Ok, thank you.

But I don't have any account on bugzilla. Could you create me an account ?
Reply | Threaded
Open this post in threaded view
|

Re: NEWT : Drag and Drop

gouessej
Administrator
Done. Read your emails ;)
Julien Gouesse | Personal blog | Website