It's now possible to query Meta & Super modifier keys:

  SDL  ... Meta & Super supported
  OSG  ... only Meta supported  (would be easy to fix in OSG)
  GLUT ... no support, as usual  :-}

These modifier keys are set in keyboard events
(/devices/status/keyboard/events/modifiers/{meta,super}) and
can also be queried independent of events via
/devices/status/keyboard/{meta,super}.

  <binding>
      <condition>
          <property>/devices/status/keyboard/super</property>
      </condition>
      <command>exit</command>
  </binding>

Because not all operating systems, all keyboards, and all
setups support these modifiers, they must *not* be used in
files committed to CVS. (That's why I didn't bother to add
<mod-meta>/<mod-super> XML tags.) But they can be used for
local key definitions, where they are safe from changes to
regular fgfs key bindings.

On Unices you can turn Windows/Menu keys into modifiers,
by putting something like this in your ~/.Xmodmap:

   clear mod5
   keycode 115 = Super_L
   keycode 116 = Super_R
   add mod5 = Super_L Super_R

These may be different key numbers on some keyboards (129 and 131
here). Use xev to get the number. I use the attached script at
the moment, to assign functions to Meta-v, Meta-s, Meta-`. I have
yet to migrate my other local key bindings to this new system.

m.



PS: support for "Hyper" is not planned.  :-)
_setlistener("/devices/status/keyboard/event", func {
        var event = cmdarg();
        if (handle_key_event(event.getValues()))
                event.getNode("key").setValue(0);
});


var handle_key_event = func(e) {
        #debug.dump(e);
        if (!e.pressed or !e.modifier.meta and !e.modifier.super)
                return 0;

        if (e.key == `s`) {             # toggle shadows
                var i = !getprop("/sim/rendering/shadows-ac");
                setprop("/sim/rendering/shadows-ac", i);
                setprop("/sim/rendering/shadows-to", i);
                setprop("/sim/rendering/shadows-ai", i);

        } elsif (e.key == `v`) {        # save aircraft state
                ac_state.save();

        } elsif (e.key == `\``) {       # set daytime midnight
                fgcommand("timeofday", props.Node.new({ timeofday : "midnight" 
}));

        } else {
                debug.dump(e);
                return 0;
        }
        return 1;
}

-------------------------------------------------------------------------
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