1
0
Fork 0

use modifier mask as reported by the input system

This commit is contained in:
mfranz 2008-04-26 13:28:47 +00:00
parent 1544af3ab9
commit eee5773db5

View file

@ -13,14 +13,11 @@ top down before the key bindings are parsed.
<PropertyList> <PropertyList>
<nasal> <nasal>
<script> <script>
var modifiers = props.globals.getNode("/devices/status/keyboard");
var shift = props.globals.getNode("/devices/status/keyboard/shift"); var shift = props.globals.getNode("/devices/status/keyboard/shift");
var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl"); var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
var alt = props.globals.getNode("/devices/status/keyboard/alt"); var alt = props.globals.getNode("/devices/status/keyboard/alt");
var get_modifiers = func {
shift.getValue() + 2 * ctrl.getValue() + 4 * alt.getValue();
}
var space_release = func {} var space_release = func {}
var space = func(state, mod) { var space = func(state, mod) {
if (!state) { if (!state) {
@ -29,7 +26,7 @@ top down before the key bindings are parsed.
} }
if (mod == 0 or mod == 1) { if (mod == 0 or mod == 1) {
controls.ptt(mod + 1); controls.ptt(mod + 1);
space_release = func { controls.ptt(0) } space_release = func controls.ptt(0);
} }
} }
@ -272,23 +269,23 @@ top down before the key bindings are parsed.
<desc>PTT - Push To Talk (via VoIP)</desc> <desc>PTT - Push To Talk (via VoIP)</desc>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>space(1, get_modifiers())</script> <script>space(1, modifiers.getValue())</script>
</binding> </binding>
<mod-up> <mod-up>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>space(0, get_modifiers())</script> <script>space(0, modifiers.getValue())</script>
</binding> </binding>
</mod-up> </mod-up>
<mod-shift> <mod-shift>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>space(1, get_modifiers())</script> <script>space(1, modifiers.getValue())</script>
</binding> </binding>
<mod-up> <mod-up>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>space(0, get_modifiers())</script> <script>space(0, modifiers.getValue())</script>
</binding> </binding>
</mod-up> </mod-up>
</mod-shift> </mod-shift>