<AWT Dev> AWT event to XEvent
Artem.Ananiev at Sun.COM
Mon Feb 1 02:16:59 PST 2010
I'm not sure I've got what you're writing about... See particular
On 2/1/2010 11:31 AM, meteor wrote:
> Hi all,
> Have been working on JAVA for quite some time and have been using the Nabble
> forums quite frequently for any JAVA related issues. Although this time
> around for the issue I have in hand am not sure if it is possible to solve
> or not. Am actually working on an application for which part of its UI is
> developed in C++ and uses Motif while part of the UI is developed in JAVA
> which uses the standard AWT package. CORBA is used to communicate between
> C++ and JAVA. Now in a particular case I am generating an AWT event on the
> JAVA UI and need to capture that as an XEvent on the C++ side for some
> reason. Both these UI have there individual event handlers i.e.
> ActionListeners on the JAVA side and XEventLoop on the C++ side to handle
> the events occuring on them individually. But in this particular case I want
> to capture an AWT event by the XEventLoop on the C++ side.
I hope you don't rely on Motif's implementation of AWT and only use
Motif in your code. MToolkit (Motif-based AWT toolkit) is almost gone
> Am sure this is a not a very peculiar case and there are instances where an
> AWT Event needs to be converted to an native event. Have come across a
> couple of ideas for doing the same:
> 1) Re-Design my XEventLoop to listen/process the AWT events as well and
> register the Java application as an observable for the XEventLoop. The
> problem with this approach is that am not sure if that is possible (dont
> have so much experience in working with XEvents) and even if it is possible
> this will require re-designing the entire XEvent mechanism which I hate to
Do you mean your C++ event loop to process both application XEvents and
AWT XEvents and then forward the latter ones to AWT? This is currently
unsupported, and I doubt it will ever be.
> 2) Somehow convert the AWT event to the native XEVent since an AWT event is
> generated by XEvent so I believe converting it back to an XEvent should be
> possible. Again am not sure if this is the right thing to do since I may
> loose some information in doing so and am also not aware of any direct way
> of doing this.
Obviously, most of AWT events are caused by native XEvents. However, you
must realize that the conversion is very deep AWT internals, and the
things may change at any moment in the future.
The question is: why do you need to process AWT events (converted back
to XEvents) in your applications? Could you track the events at Java
level and forward them to your application (using CORBA)?
> This task seems to be very challenging and have spent a lot of time on this
> but am not able to come up with a concrete solution. Hope to get some help
> from you all.
> Any help in this regard is appreciated.
More information about the awt-dev