-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding unknown keysym until keysym table is full and no further input possible #93
Comments
This is an unfortunate limitation in the current architecture. So I'm afraid we don't have any easy fix for it. As a workaround you can change the keyboard layout in the VNC session to reset things. |
The same problem I have with CentOS 7. My locale is ru_RU.utf8. |
Yes. Reloading a fresh keymap with setxkbmap will reset the table. |
I mean how can I modify the vncAddKeysym() function call to reset the table. I'm not so good at C coding but I understand that the reset can be possibly done here or inside the function. But I don't know how exactly to reset the table (table array name and method to reset). Can you suggest please? |
Not sure. It's not trivial as we cannot easily tell what we've added and what has been added by the user. |
I've spent some time to investigate the issue and found that everything works fine if the local language is correspondent to the input layout language of a client. At the same time if I use my Mac's VNC client, I can't use Russian characters in any of the cases. In the first case I see in logs "Added unknown keysum" but I don't see any characters appear. This happens until the table is full. It seems that some VNC clients handles with this issue in some way, some doesn't do anything. Hope this will help. |
So, should we just run setxkbmap every minute in crontab, or...? |
Setting the same layout as you have on the client should avoid most issues. Swapping between very different layouts will most likely require you to swap in the VNC session as well though. You can also try the new |
We swap between "us" and "ru" layouts all the time, a couple of times per minute is typical. In my case the client is Windows 7, two keyboard layouts are installed there, switched by Ctrl+Shift. What should I set in the VNC session? Tried at first the usual "physical X server style" invocation,
then, simplified,
Neither helps completely. After a few minutes of casual input, some keys will randomly stop being accepted. Message in the log is as mentioned above, "Failure adding new keysym..." The only "solution" was to run setxkbmap again. Then it logs "Added unknown keysym" and inputs fine. And seriously, setting up the latter variant in crontab (while ensuring the user and DISPLAY variables are correct) to run every 5 minutes seemed enough to not let the issue reoccur. This problem does not happen with the "stock" VNC server from Debian 8. In fact that one does not support the XKB extension at all. But us/ru input still works there, and does not fail over days or even months of operation. |
This will generally not work well since there is no mechanism to sync the switching between the layouts.
This should work as long as you are using the Russian layout on the client. If you switch to American then you'll have to call Are you saying this case isn't working?
It should have the same behaviour. Can you check exactly what that server is? |
-layout ru results in Cyrillic symbols entered being accepted quietly; but Latin symbols result in the "Added unknown keysym" message in the logs. I guess this is expected up to this point. What is not expected, is that after a few minutes of operating like that, some Latin characters stop being accepted (no pattern which ones), and instead start to produce the same "Failed to add unknown keysym" message.
How would I do that? As I said we switch multiple times per minute casually. The keyboard layouts are changed on the client via a simple press of Ctrl+Shift, the VNC client is just another regular application there, it gets whatever characters currently selected layout's keypresses result in. So practically it gets an intermixed stream of Cyrillic + Latin characters. I don't think there's a mechanism to notify the server of a layout change on the client and then execute a specified program there. RawKeyboard that you mentioned sounds promising, but I did not try that yet.
I meant not TigerVNC in Debian, but the original VNC server in Debian Jessie (pre-TigerVNC migration), this one: https://packages.debian.org/jessie/vnc4server
But no problems with input whatsoever. |
I set keyboard switch to application on client (KDE, Krdc). Some time it switch layout on server with Ctrl+Shift synchronously wich client some time it loose switch key press and client and server becomes in different layouts and this problem happens. |
By hand unfortunately. Or if you can get a keyboard layout switcher in the desktop tray in the VNC session. This is a use case where we don't really have a good solution at the moment. :/
I assumed as much. But that is RealVNC, which AFAIK uses the same method as TigerVNC. So it's worth investigating why the problem isn't seen with that server. |
Alright, so I had a look at vnc4server in Debian 8 and it does indeed have the exact same behaviour as TigerVNC. However it has absolutely ancient keymaps (e.g. no multimedia keys) resulting in lots of free space for extra characters. On a default startup it has 148 available slots. TigerVNC with a current Xorg has 24. So if you can manage to load such an older layout then you could also avoid the issue. |
Could you give a hint how to do that? I looked and tightvnc-standalone-server doesn't seem to ship any keymap files. And doesn't seem likely it uses those from xkb-data either. Also I wonder if I even need such an extensive keymap. I do not use multimedia keys inside the VNC session for instance, I do not watch video or play music over VNC. How would I go about creating or loading a very minimal layout to free up more slots? |
Sorry, but I don't know. I have not really played around with the definition files. If you dump things using |
Hello, guys! Already built a Xvnc from this and it works! |
Hi, Ogurets! Thanks for your efforts!! Your patch is lifesaver!! :) I've tried your solution, but it thas troubles with quick input. Can you think about some enhancements to your method? UPDATE.
VNC works great now. Here is my changes
|
|
Actually, there's a problem with |
That sounds like a generic problem, and not an issue with the keymap. Please open a new issue with more details on your setup. Also please try to include a debug log from the server and/or client. |
Never mind. It was only one old app that was affected, one running under Wine at that. |
@CendioOssman I have a proposal to fix this. Basic idea is to "remember" the KeyCodes for which KeySyms has been added by TigerVNC, and reuse those when unused keys are no longer available.
With this scheme, for a user/system specified key to be overwritten by TigerVNC, it has to have the same customized Name & KeySym as assigned by TigerVNC, and has to be specified after TigerVNC has assigned it. To reduce the number of keymap updates, I have done some preliminary testing, and wanted to know if this is acceptable and worth implementing. |
That sounds like a very reasonable approach, yes. Something similar was done for x0vncserver in #1510. Ideally, we start sharing more of the keyboard handling between x0vncserver and Xvnc, as they are trying to solve the same problem. We've already done so for RandR handling in |
I looked at RandR implementation, and as I understand it, common functionality is implemented in In case of custom KeySym assignment, difference between This common functionality can be moved to something like |
One issue I found is which XKB headers to use in common code. If the header is abstracted via "InputGlue.h", we have to duplicate a lot, essentially nullifying the benifit of shared code. |
They are seemingly very similar, but not identical. Which does indeed complicate things... |
One option is to treat common files as "source library" instead of "binary library". Both This is already happening in some sense via |
Not ideal given there are different build systems for Xvnc vs x0vncserver. But give it a go, and we can see what it looks like. |
I was experiencing simillar problem with binding keysyms to keycodes and wrote solution like this: source (XCB code, not for X server). Shortly: My solution works like a charm in client side program but I am not sure if I can port it to server side. I hope it will help you fix this issue. P.S. After receiving XCB_XKB_NEW_KEYBOARD_NOTIFY my code is processing keymap to get sorted table of unicodes with corresponding keycodes, groups (layout numbers) and modifiers for binary search. It is needed to type needed unicode symbol as fast as possible using as few resources as possible. This is especially relevant for the case if you are typing on Android device in language that is not present on target PC or if alphabet of this language can not be bound to keyboard layout (i.e. Chinese, Japanese, etc.). Thank you in advance. |
Actually replacing code in
with
works even without resetting keys back to scratch. |
also partially fixes TigerVNC#93, as most(?) keyboard symbols aren't "unknown" anymore.
Is this considered fixed then? |
No |
@twaik On May 22 you mention replacing code in |
Do you mean that? It searches scratch keys on the current layout. |
Instead of giving up after all free keycodes have been used, Keycodes from previously added keysyms will be reused. Re: TigerVNC#93
Instead of giving up after all free keycodes have been used, Keycodes from previously added keysyms will be reused. Re: TigerVNC#93
Instead of giving up after all free keycodes have been used, Keycodes from previously added keysyms will be reused. Re: TigerVNC#93
This has now been fixed in #1734! :) |
So glad to hear. But I just downloaded the latest release to try out, turns out the release is from Jul 23 with the fix not included yet. :( Thanks |
I have a (Arch Linux) client box connecting via vncviewer to a (Arch Linux) server running (tigervnc) vncserver. On my client I use two languages (setxkbmap -layout us,bg (phonetic) -option grp:alt_shift_toggle) - switching and using both languages on the client is fine, both languages work on the server when in a terminal session, however when I connect to the VNC desktop, keys stop responding after a while. Relevant errors in ~/.vnc/hostname:1.log
Running xev shows some weird stuff - when pressing 'd' for instance
and xmodmap -pke would report that 'd' was added to 149
The table has room for 255 entries and they fill up really quickly - when it is full, I'm not able to use any 'unknown' keys that werent added to the table before it was full.
Locales on both machines
tigervnc is at latest version (1.4.0-1 from official arch repository)
The text was updated successfully, but these errors were encountered: