Board index FlightGear Development

Trouble with effectuating XML key bindings  Topic is solved

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Trouble with effectuating XML key bindings

Postby PH-JAKE » Tue May 12, 2020 10:28 am

My initial goal is to experiment a little with property manipulation from the keyboard.

Context: FlightGear 2019.1.1 as provided through the Debian packaging system, on Debian testing.

So after some research I went into /usr/share/games/flightgear/keyboard.xml (where Debian places the FlightGear data) and modified the key binding for the 'Left' keypad key from this:

Code: Select all
 <key n="52">
  <name>4</name>
...
  <mod-shift>
   <desc>Look left</desc>
   <binding>
    <command>property-assign</command>
    <property>/sim/current-view/goal-heading-offset-deg</property>
    <property>/sim/view/config/left-direction-deg</property>
   </binding>
  </mod-shift>
...
 </key>

to this:
Code: Select all
 <key n="52">
  <name>4</name>
...
  <mod-shift>
   <desc>Look left</desc>
   <binding>
    <command>property-assign</command>
    <property>/sim/current-view/goal-pitch-offset-deg</property>
    <property>/orientation/roll-deg</property>
   </binding>
  </mod-shift>
...
  </key>

What I was expecting is that the 'Look left' action would be replaced by the 'Adjust view pitch' action, since this is what the involved properties pertain to.
What I got was the 'Look left' action, same as before.

In order to verify that this keyboard.xml file was indeed read, I made a syntax error in it and started FG again. Sure enough it complained about the syntax error, confirming it was read.

Next I searched for other XML files in the FlightGear data files to see if they had overriding key bindings for this, but I could not find one.
I also tried different planes to see if it was model specific, but both the F16 and C172 showed the same behaviour. Also neither of these planes appear to have overriding key bindings for this key.

So I'm left to wonder if/where these key bindings are cached, and/or why this is not updated from the XML file? Am I missing some step to effectuate this?
Can you provide me some pointers where to look for clues, e.g., how to investigate what the current bindings are (although that seems obvious), where these come from (not so obvious perhaps), what logs could be valuable to inspect?

TL;DR: changing key binding in keyboard.xml, but the change is not effectuated. What did I miss?
PH-JAKE
 
Posts: 156
Joined: Wed Mar 12, 2014 12:53 am
Callsign: PH-JAKE
Version: 2020.3.18
OS: Debian trixie

Re: Trouble with effectuating XML key bindings  

Postby stuart » Tue May 12, 2020 7:51 pm

Hi PH-JAKE,

There are two keybindings for the "left" keypad. The one you've edited is the one for Shift-4 (e.g. when NumLock is on). There's another one on line 1388 for when the NumLock is off.

Perhaps try that one?

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1629
Joined: Wed Nov 29, 2006 10:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Trouble with effectuating XML key bindings

Postby PH-JAKE » Tue May 12, 2020 9:54 pm

Oh crap, I never noticed those. I'll definitely play around with these tomorrow.

Thanks Stuart.
PH-JAKE
 
Posts: 156
Joined: Wed Mar 12, 2014 12:53 am
Callsign: PH-JAKE
Version: 2020.3.18
OS: Debian trixie


Return to Development

Who is online

Users browsing this forum: No registered users and 8 guests