Subject: Bug#674: [X2Go-Dev] Bug#674: Acknowledgement (keycode -> keycode translation harmful (makes configuration complex))

From: Robert Siemer <[email-masked]>
Date: Sat, 13 Dec 2014 01:45:02 +0100

On 08/12/14 00:07, Ulrich Sibiller wrote:
> On Sun, Dec 7, 2014 at 5:07 AM, Robert Siemer <[email-masked]> wrote:
>> On x2go session startup, the x2go Xserver [2] does a superficial
>> investigation of what keyboard is used on the local Xserver [1] and sets up
>> an incomplete keycode translation to a keyboard known as “xfree86”. It
>> further creates an imperfect copy of the XKB configuration from [1] to [2].
>> The _XKB_RULES_NAMES property on [2] is set to rules=xfree86, model = pc???,
>> layout = us(?) [I forgot the details].
>>
>> Why is it a superficial investigation? – It takes the rules name from
>> _XKB_RULES_NAMES and deducts the resulting keycodes directly from that (I
>> believe). Even though in a common setup rules name “evdev” results in one
>> specific set of keycodes and rules name “xfree86” in another specific set of
>> keycodes, this is not a must.
>>
>> Why is the keycode translation incomplete? – As far as I observed it,
>> “unusual” or unknown keycodes are not translated and passed as-is.
>>
>> Why is the XKB configuration copy imperfect? – I did a XKB dump on the local
>> Xserver [1] and the x2go Xserver [2] after starting a new session. Keys with
>> four levels of symbols turned into two-level-keysyms. – _Loading_ (i.e.
>> xkbcomp/setxkbmap) a four-level configuration is no problem, though.
>>
>> Note: the imperfect copy of the XKB configuration is almost always useless,
>> because the copied configuration does not match the new (translated)
>> keycodes!
>>
>> Resuming an x2go session triggers the same superficial keyboard
>> investigation, the translation kicks in again, but the XKB configuration is
>> not touched (i.e. is not copied from [1] to [2]).
>>
>> Deleting the _XKB_RULES_NAMES property before session startup/resume or
>> setting the first part (that is the “rules” part) to some unknown string
>> results in untranslated keycodes.
>
> I am not sure if I am getting this right. Will using xkbcomp on the
> local server, pushing the result to the nxagent and loading it there
> result in a clean keyboard setup or not?

That depends on whether the keycode translation is on or off.

If the translation it is not in effect, then yes, you get a setup like 
you have without x2go.

If the translation is on, you get a skewed setup.

Note that the x2go (with the setting of “do nothing”) does a non-perfect 
copy with the same effect: if the translation is effective, the keyboard 
is skewed and you are force to load at least “something” to fix XKB. If 
the translation is off, you “only” need to load XKB configuration if 
that non-perfect copy annoys you...

Btw, the forme is exactly what I do: dump local XKB configuration, make 
sure I don’t get a translation in x2go and load it on the other side.

> BTW: You can find the code for the keycode translation in
> nx-x11/programs/Xserver/hw/nxagent/Keyboard.c.

Thanks for the pointer! I had a look at it. As I suspected: the 
translation is “bad”. Sometimes two different keycodes are translated to 
the same keycode. How are you supposed to tell them apart on the remote 
side? You can’t.

> It seems some kind of translation from evdev to pc105 is done.

The naming is a little funny: the keycodes generated by the kernel 
before evdev were not called like that, were they?

 > Do we need to disable setting
 > up the translation within the nx code to make that work?

That would be great as a first step.