xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.

Changes between Initial Version and Version 3 of Ticket #1484

04/04/17 09:14:13 (5 years ago)
Antoine Martin

"en" keys (latin keys really) are still mapped on a "ru" keyboard layout, which is why switching from "ru" to "en" works. But many "ru" keys do not exist on an "en" keyboard layout, and so they cannot be mapped.

Sadly, there is no reliable way of detecting the current locale used for keyboard input. See "locale" in KeyboardEvent (only supported by IE) And even the more convoluted layout detection code we have does not apply when the user changes the layout: if I call setxkbmap us on my client system, all the HTTP request headers and all the browser attributes still have my preferred locale first ("en_GB"). r15510 adds code to re-detect the keyboard layout whenever one of those properties changes, but it doesn't fire with chrome or Firefox. (not tested IE)

So I was starting to think that this could not be fixed without requiring user interaction and adding a language menu to the html5 toolbar. (planned in #1471) But then it occurred to me that we can guess which keyboard layout is actually needed based on the keyname (ie: "Thai_thothan" requires a "Thai" or "th" keyboard layout), so r15511 does that. With this change, the HTML5 client will request the server to switch to a new keyboard layout when it sees keys it knows belongs to a specific layout ("Greek", "Thai", "Cyrillic", "Hebrew", etc)


  • there may be a slight delay as the change is aynchronous
  • we rate limit those changes to prevent server DOS
  • this will not switch back to the original layout when the user starts typing in "latin" again because we don't keep track of all the layouts we have used, only the current one
  • there's bound to be some corner cases, but this is likely to be as good as it is going to get given Javascript's API limitations


  • Ticket #1484

    • Property Owner changed from Antoine Martin to Denis01
    • Property Type changed from enhancement to defect
  • Ticket #1484 – Description

    initial v3  
     1Follow up from #1487:
    23Somebody already told about this function but seems not declared ticket (at least I have not found, correct me if I am wrong).