[Thinlinc-technical] multiple modifiers

Peter Astrand astrand at cendio.se
Thu Jan 24 14:58:40 CET 2013


On Thu, 24 Jan 2013, David Edmondson wrote:

> That said, I notice that Xvnc is running with what appears to be a
> Swedish keyboard map?
>
> /opt/thinlinc/libexec/Xvnc :1 -depth 24 -geometry 1920x1200 -fp
>  catalogue:/etc/X11/fontpath.d,/usr/share/fonts/X11/misc,/usr/share/fonts/X11/Type1,/usr/share/fonts/truetype
>  -auth /var/opt/thinlinc/sessions/dme/1/Xauthority -desktop
>  dme at gag-halfrunt -rfbport 5901 -rfbauth
>  /var/opt/thinlinc/sessions/dme/1/sessionkey -br -nolisten tcp -localhost
>  -KeyboardMap=sv
>
> I didn't consciously do anything to cause this (though I have to confess
> that at one point I did modify the session starter code to pass +kb, but
> took that out again).

Yes, the shipped default configuration is actually to use a Swedish 
keyboard in the server side session. The reason for this is that such a 
keyboard layout "should" be a superset of a US keyboard. In general, the 
server layout should not matter unless you use applications which 
interprets the raw keycode. So the idea was that having Swedish by default 
would make things works out of the box for both US and Nordic customers.

But, now it seems that there's a regression between 3.4.0 and 4.0.0 wrt 
the Swedish layout.


>> When I'm testing, the "end-of-buffer" command is executed correctly
>> when I press Alt, Shift, "<", but if I press Shift, Alt, "<", then a
>> ">" is inserted. This is repeatable.
>
> Yes, this matches with my previous feeling and some quick testing. I'll
> try to train my hands, but it will be hard :-)

:-)


> Whilst I mostly understand your explanation, there are a couple of
> things that don't seem right:
>
>> Yes, this looks a little bit strange, but this is actually how it
>> "should" be. Here's the details: We are using the VNC protocol, which
>> transfers symbolic "keysyms" rather than physical "keycodes". However,
>> modifier keys also have keysyms. When you press, the windows key,
>> Super_L is immediately transferred. Same goes for Shift_L.
>
> I didn't press Shift, and semi-colon is not a shifted character on my
> keyboard. (Comment below on why this is a problem.)

I see. In that case, it's probably due to the Swedish layout you had in 
the session.


>> Then, an actual symbol is produced at the client side: ";", so it is
>> transferred as well. The keyboard state in the remote session has both
>> Super_L and Shift_L activated. Fortunately, the keyboard layout table
>> has a way producing ";" in this state. (If not, additional modifiers
>> will be "faked".) Then, the server will generate keycode 59, and the
>> actual ";" will be produced. During release, "," will be produced
>> since Shift_L has already been lifted.
>
> Comma and semi-colon are not on the same key, which I would expect to be
> a requirement for this explanation to make sense.

It is on a Swedish keyboard :-)



>> This is ok; this is what will happen on a local workstation as well,
>> if you lift Shift before the symbol key. Applications should not care.
>
> This causes trouble because I have different keybindings for
> Mod4-semicolon and Mod4-Shift-semicolon. The result of the spurious
> 'shift' being set in the modifier bits (it's an XCB application reading
> the key presses) is that the wrong binding is executed.

I see. Yes, that can be a problem. With a Swedish layout in the session, 
it is not possible to generate Mod4-semicolon without shift. You would 
need to add an unshifted mapping for this to work, ie something like:

xmodmap -e "keycode 250 = semicolon"

I haven't thought of this before. This means that the Swedish layout is 
not a correct superset of the US map after all.



> Ah - I just looked at the Swedish layout on Wikipedia and semi-colon is
> shifted comma! That would fit with the -KeyboardMap=sv argument and your
> explanation.
>
> How do I change the keyboard map passed to Xvnc?

I saw that you found out; for others, it's the parameter 
/vsmagent/xservers_args.


Rgds, 
---
Peter Astrand		ThinLinc Chief Developer
Cendio AB		http://cendio.com
Teknikringen 8		http://twitter.com/ThinLinc
583 30 Linkoping	http://facebook.com/ThinLinc
Phone: +46-13-214600	http://plus.google.com/112509906846170010689


More information about the Thinlinc-technical mailing list