Bug 5269 - Easily running out of keycodes when dynamically allocating Xvnc keysyms
Summary: Easily running out of keycodes when dynamically allocating Xvnc keysyms
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VNC (show other bugs)
Version: 4.2.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.19.0
Assignee: Pierre Ossman
URL:
Keywords: relnotes, upstream
Depends on: 8485
Blocks: keyboard 7540
  Show dependency treegraph
 
Reported: 2014-09-24 13:27 CEST by Peter Åstrand
Modified: 2025-03-12 16:06 CET (History)
2 users (show)

See Also:
Acceptance Criteria:
MUST: * Applications in the session get an event with the correct symbol, even when the client and server have different layouts, even when the client or server switch layouts COULD: * Automatic changes to the server-side layout should be kept as few as possible


Attachments

Description Peter Åstrand cendio 2014-09-24 13:27:35 CEST
When an "unknown" keysym is recieved by Xvnc, it will dynamically allocate one from the "xmodmap table". Unfortunately there's only room for 255 keycodes. Our default table nowadays includes many multimedia keys etc, so there's only 29 free positions. If the client uses more keysyms than this (consider cyrillic clients for example), we will run out of free positions. The effect is that no (new) symbols can be entered. 

I guess it's difficult to find a real solution for this, but we could perhaps tweak the allocation somewhat, for example consider removing rarely used keysyms to make room for new ones.
Comment 1 Pierre Ossman cendio 2018-05-02 12:57:41 CEST
An administrator can mitigate this problem by configuring the default keyboard layout to the layout users are actually using (we have "us" layout by default).

A user can also work around the issue by manually setting the keyboard layout inside the session (using setxkbmap or some GUI).
Comment 3 Pierre Ossman cendio 2020-08-17 10:25:42 CEST
This command can be run to see how much free space a layout has:

> xmodmap -pke | grep '=$' | wc -l
Comment 6 Samuel Mannehed cendio 2024-10-09 16:31:33 CEST
This is now fixed in upstream TigerVNC:

https://github.com/TigerVNC/tigervnc/pull/1734
Comment 9 Pierre Ossman cendio 2025-02-24 16:34:29 CET
Works well. Tested on a RHEL 10 beta server with a Swedish layout configured in the session, and switching between Swedish, Russian and Hebrew on a Fedora 41 client.

With ThinLinc 4.18.0 new keys eventually stopped working, but with build 3926 all keys worked just fine.

> MUST:
> 
>  * Applications in the session get an event with the correct symbol, even when the client and server have different layouts, even when the client or server switch layouts

Yup. All keys just work<TM>

> COULD:
> 
>  * Automatic changes to the server-side layout should be kept as few as possible

I'd say so. The most recently used keys remain untouched if a previously unknown key shows up. Tested by running "xev" in the background and seeing the MappingKeyboard events.

Note You need to log in before you can comment on or make changes to this bug.