Bug 1437569

Summary: x0vncserver incorrectly maps keysym from vncclient running german keyboard
Product: Red Hat Enterprise Linux 8 Reporter: Dmitry Zhukovski <dzhukous>
Component: tigervncAssignee: Jan Grulich <jgrulich>
Status: CLOSED ERRATA QA Contact: Radek Duda <rduda>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.7CC: kretschmer.jens, mboisver, tpelka, tpopela, yferszt
Target Milestone: rcKeywords: Reopened, Triaged, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tigervnc-1.12.0-9.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2119017 2150915 2150916 (view as bug list) Environment:
Last Closed: 2023-05-16 08:36:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2119017, 2150915, 2150916    
Attachments:
Description Flags
xev trace from linux client where Pipe is working
none
xev trace from windows client where Pipe is not working none

Description Dmitry Zhukovski 2017-03-30 14:45:05 UTC
Description of problem:
x0vncserver incorrectly maps keysym from vncclient running german keyboard

Version-Release number of selected component (if applicable):
7.3 and also tested on 7.4/fedora 25

How reproducible:


Steps to Reproduce:
1. Set Windows client to German keyboard
2. configure x0vncserver and connect to it from win client
3.

Actual results:
at least |(pipe) is not mapped anywhere

Expected results:


Additional info:
Linux to Linux works without problems.
x11vnc has -modtweak functionality that fixes it.

Comment 2 Dmitry Zhukovski 2017-04-03 09:30:36 UTC
Created attachment 1268319 [details]
xev trace from linux client where Pipe is working

Comment 3 Dmitry Zhukovski 2017-04-03 09:31:08 UTC
Created attachment 1268320 [details]
xev trace from windows client where Pipe is not working

Comment 4 Jan Grulich 2017-04-04 09:12:32 UTC
Hi,

I managed to reproduce this issue with TigerVNC client (viewer) running on windows and TigerVNC server running on Linux. I did some investigation and it appears that this is not actually a bug, but it's by designed to work this way. here is a snip of documentation about keyboard keys from TigerVNC:

- Modifiers:

  X11: You can usually toggle Hyper/Super and Compose/Scroll_Lock using
       XKB options.

  - CapsLock, NumLock (sent but ignored by server)
  - Shift, Ctrl
  - Alt, AltGr, Super [Win, X11] (FIXME: AltGr broken on Win)
  - Meta [X11]
  - Left/right identification (FIXME: broken for Shift on Win)
  - CmdL => AltL, CmdR => SuperL, AltL => ModeSwitch, AltR => Level3Shift [OS X]
  - Hyper sends Super [X11]

  - CapsLock, Shift and AltGr affect symbol lookup
  - Ctrl does not affect symbol lookup
  - CtrlL+AltR is fake released to compensate for Windows' AltGr magic [Win]
  - Ctrl+Alt+<ANY> sends the same symbol as <ANY> (note behaviour above though)
  - Ctrl+AltGr+<ANY> sends the same symbol as AltGr+<ANY> (FIXME: broken on Win)
  - "Shift press, A press, Shift release, A release" should not send "a release"

So as you can see, using Ctrl + Alt + ANY_KEY results into pressing just ANY_KEY. I don't think I can do anything about this at this moment. I also tested this with TightVNC (another vnc client) and this one is configured differently and sending Ctrl + Alt + ANY_KEY worked just fine.

Comment 5 Jan Grulich 2017-04-18 08:45:54 UTC
Source code for reference:
https://github.com/TigerVNC/tigervnc/blob/master/vncviewer/Viewport.cxx#L447

Comment 18 Jan Grulich 2022-04-26 12:11:55 UTC
I tested following:

1) Install RHEL Workstation 9 (with RHEL 8 it should be same) into GNOME Boxes
2) Disable GDM with "systemctl disable gdm.service"
3) Reboot → Login → run "startx" 
4) GNOME starts → open GNOME terminal
5) Run "vncpasswd" to setup password for VNC
6) Run "x0vncserver -Display :0 -PasswordFile=/home/jgrulich/.vnc/passwd -AlwaysShared=1"
7) Set German keyboard layout on the client
8) Run "vncviewer" for Windows using Wine and connect to the server
9) Try to type e.g. "|" with AltGr + "|" on the keyboard button next to the shift on the left side
10) Observe it doesn't type anything

Workaround:
1) Set German keyboard layout on the server
2) Run "x0vncserver -Display :0 -PasswordFile=/home/jgrulich/.vnc/passwd -AlwaysShared=1 -RawKeyboard" 
- from documentation: send keyboard events straight through and avoids mapping them to the current keyboard layout. This effectively makes the keyboard behave according to the layout configured on the server instead of the layout configured on the client.
3) Run "vncviewer" for Windows using Wine and connect to the server
4) Try to type e.g. "|" with AltGr + "|" on the keyboard button next to the shift on the left side
5) Observe it types "|" as expected

Can you try to use "-RawKeyboard" option and verify it works for you as expected?

Comment 20 Jan Grulich 2022-08-15 10:24:04 UTC
I have a fix pending upstream: https://github.com/TigerVNC/tigervnc/pull/1510

It was confirmed by the customer that this fixes the issue, I'm just waiting on feedback from upstream whether we should do it this way or whether we should hide it under an option so we don't break default behavior for other users.

Comment 22 Radek Duda 2022-12-05 13:39:41 UTC
Reproduced with old tigervnc-1.12.0-7 - cannot type '|' to vnc server

installed new tigervnc-1.12.0-8 - I can now type the '|' from Win10 client to RHEL8 vnc server

Comment 30 errata-xmlrpc 2023-05-16 08:36:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: tigervnc security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2830