Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After creating index its time to add the conditional map entries into X11 and keyPress array. It will depend on your keyboard in which you want to put your conditional entries.

Conditional map entries looks likecan be of two types

Type 1 (entry is numeric code)

{keycode: 34,      entry: 0x40,   guestos: "windows"},
{keycode: 160,  entry : 0x5e,  guestos: "windows",    browser: "Firefox"},,  entry : 0x5e,  guestos: "windows",    browser: "Firefox"},

Here entry is numeric code. If entry doesn't match the conditions then default handling will be done. 

 

Type 2 (entry is of array type)

{keycode: 43, entry: [
{type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
{type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false },
{type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false },
{type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
{type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true },
{type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true },
]
}

Here entry is array of entries. Each entry states the conditions on which it will match and the code to which it will match. If one specifying entry in this format then he/she has to specify entry for all the possible combinations. By possible combiations it means that entries should be able to find mapping. If they are not able to identify mapping then no event will be sent. So If you are specifying browser in one condition then you have to specify entries for all browsers. 

 

Here keycode is input keycode and entry is output which will determine the key shown on VM console. This entry will only applied if it matches condition which are mentioned next to it.

...

Conditional mapping entries can be defined on the conditions which are mentioned in glossary mentioned in glossary conditional mapping entry.


We should normally be using only Type 1 entries but in some exceptional cases Type 2 entries can also be used. Type 2 entries can be used if one want different code KEY_DOWN and KEY_UP for keycodeconditional mapping entry.

 

How to identify input keycode and output keycode (Taken from FS)

...

Browser, type and guestos all have string type.

 

Where should key entry go

If key is printable (can be seen after typing in document like ascii characters) then it should go in keyPress map. For prinatble keys we are guaranteed of keyPress event. One can verify whether keyPress event is generated using sites available online. One such site is http://unixpapa.com/js/testkey.html. All other keys except printable should go in X11 keys.

 

Find the input_keycode and output_keycode for a particular key

...

To find out the Input_keycode, we can turn on the keyboard logger window which will show the keycode for every key pressed. “CTRL-ATL-SHIFT+SPACE” turns on the lodger or click on green circle icon on top-right corner. To have a fresh window to show the code for a new key, clear the window first, and then press a key. 

However, for the value of output_keycode, it is tricky. It is more of a trial and error process. We can search the keyboard standard key document, and try various values. We can try pressing different keys and see what input_keycode  generates what output on console. Using these trials we can get the output_code of the key. 

...