* Melchior FRANZ -- Sunday 02 December 2007:
> Tadaaa: The TAB modifier!   :-)

D'oh! I had tried it with +500, and just to make it prettier I
changed it to 1000 before posting. And that crashes, because
input.cxx sets MAX_KEYS = 1024. So we are back at 500, which
is good enough.

New version attached, even shorter, even cooler.  ;-)

m.
var local = 0;
var active = {};

_setlistener("/devices/status/keyboard/event", func {
        var e = cmdarg();
        var keyN = e.getNode("key");
        var key = keyN.getValue();
        var pressed = e.getNode("pressed").getValue();

        if (key == `\t`) {
                local = pressed;
                key = 0;

        } elsif (local) {
                active[key] = e.getNode("modifier").getValue();
                return keyN.setValue(key + 500);

        } elsif (!pressed and contains(active, key)) {
                e.getNode("modifier").setValue(active[key]);
                key += 500;
        }
        delete(active, key);
        keyN.setValue(key);
});

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to