On 31 Jul 2012, at 15:50, Thomas Geymayer wrote:

> 
> Maybe we should create different categories/priorities (just a numeric
> value) of windows where one window can only raise to the top inside a
> category.

Right, that's a pretty standard system in window ordering.
> 
> The more I think about it the less I'm convinced about a Nasal-only
> event class. There can occur many problems with (accidentally) setting
> the mouse values in the wrong order, or how to get the mouse values
> inside every affected element without copying to much properties around
> and also thread synchronisation (if it is used) will get complicated.

Right. In general since we have no way to change several properties atomically, 
relying on very complex property listeners often comes down to knowing which 
order the C++ code makes changes - the Autopilot and Environment systems have 
the issue to some degree I think.

> How do you want to register callbacks if a custom class should be passed
> as argument? Is it possible to set the value of a property node to a
> custom class?

I was assuming I'd create a Nasal ghost for Canvas::Element, and another for 
osgGA::Event, or a Canvas::Event if we need an explicit class. Then we need 
some global Nasal C functions to map from a Canvas property node to the Nasal 
ghost (i.e finding the underlying C++ canvas::Element).

All of the above is only a few lines of code and I've been doing it for 
FGPositioned recently - it's pretty easy. Once that's done we define the 
'addXYZCVallback' methods in C++, and have them capture an naFunctionRef for 
the callbacks - again I've already done this and it works nicely. When the C++ 
element receives an event it can check its registered callback list, wrap the 
event in a ghost and run whichever callbacks apply.

If you want me to prototype some code for this, I am happy to do so!

James




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to