[Spice-devel] How to adapt keymaps for spice-html5

Eric Grammatico eric at grammatico.me
Mon Mar 14 18:46:33 UTC 2016


Hi there,

I realized I was going the wrong way to fix the issue. The keyboard layout shouldnt be setup by the client end as it's defined by Xorg end. But Xspice ignores keyboard config. This could be fixed thanks to setxkbmap in .xinitrc.

In fact whatever the key is A or Q the keycode sent to Xorg is the same and Xorg chooses if it's A or Q.

Keeping this in mind, I rewrote atKnames.js and utils.js. I decided to map key symbols. This way keys which do not change with layout are kept. The others are referenced by a symbolic name which is standardise through all layout. Thus no impact to other js codes, and dependencies to kb layout are removed.

The keyboard layout config is left to the user. It could be setup either by setxkbmap in .xinitrc or command line, or thanks to any gui to setup locale settings.

I believe this could be automated. The html5 API provides a KeyboardEvent.Locale. It shoudn't be a challenge to generate a key sequence to be sent to Xorg. But I have no idea which tool to use on Xorg side to accept the key sequence and setup the kb layout. One cadidate would be the xkboption grp:alt_shift_toggle but it looks limited.

At this time I need to analyse the different behaviors from one browser to the other and implement a way to manage this.


Regards.
-
_/) Eric Grammatico.
14 mars 2016 14:10 "Christophe Fergeau" <cfergeau at redhat.com> a écrit:
> Hey,
> 
> On Wed, Mar 09, 2016 at 04:08:49PM +0000, Eric Grammatico wrote:
> 
>> Hi There,
>> 
>> Of course.
>> 
>> My suggestion is to create a subfolder <keyboards> where I'll put my
>> modified files named as the following:
>> utils_fr-FR.js
>> atKeynames_fr-FR.js
>> 
>> Add the original files in the subdir as:
>> utils_en-US.js
>> atKeynames_en-US.js
>> 
>> and add a README file to explain how to create other regionalized
>> keyboard files and how to swap (a cp to the parent dir, and config of
>> the XSpice server) from one keyboard to the other.
> 
> Maybe there could be some auto-guessing of the keymap depending on the
> browser language settings?
> 
>> Where should I submit those change ?
> 
> Best place would be the spice-devel mailing list, using either git
> send-email or git format-patch
> 
> Christophe


More information about the Spice-devel mailing list