Here's my Crazy Idea Of The Day:

The question was asked a few times, whether there are keys
reserved for local customization purposes. There are none.
But we have some completely unused shift levels. The X window
system supports 8 modifiers (usually called shift, ctrl, alt,
capslock, meta, super, hyper, and-another-one). All of them
can be combined. You can have Super-Meta-Ctrl-Shift-Alt-q.
But this isn't only hard to type in for those with only
10 fingers, it's also not supported everywhere (MS Windows?).

What we could do, though, is to "invent" a new modifier level
for local use. One that works everywhere. By just redefining
a key that is bigger than the others and easy to hit, just
like the other modifiers ... umm ... except alt, altgr)

Tadaaa: The TAB modifier!   :-)

With the attached simple script the TAB key becomes a modifier
that shifts all key codes up by adding 1000 to them. So, if you
press TAB-a, you get the <key n="1098"> definition triggered.
This works also in combination with regular modifiers Shift-Tab-a,
etc. (Except that Shit-Tab-a only triggers the <mod-shift> part
of "A", not "A" itself. Could easily be changed, but that's left
as an exercise to the student.)

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

_setlistener("/devices/status/keyboard/event", func {
        var event = cmdarg();
        event.getNode("key").setValue(handle_key_event(event));
});

var handle_key_event = func(e) {
        var key = e.getNode("key").getValue();
        var pressed = e.getNode("pressed").getValue();

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

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

        } elsif (!pressed and contains(active, key)) {
                e.getNode("modifier").setValue(active[key]);
                key += 1000;
        }
        delete(active, key);
        return 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