TigerVNC / tigervnc

High performance, multi-platform VNC client and server
https://tigervnc.org
GNU General Public License v2.0
5.24k stars 954 forks source link

Unable to correctly retrieve the status of the Shift key #1876

Open Jondoe398 opened 1 day ago

Jondoe398 commented 1 day ago

I used x0vncserver to start VNC and control the device. When entering the password in the terminal window and attempting to type the '@' symbol, the desktop freezes.

Tue Nov 19 11:38:28 2024
 XDesktop:    Allocated shared memory image
 VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888

Tue Nov 19 11:39:06 2024
 XDesktop:    Added unknown keysym at to keycode 253
X connection to :0 broken (explicit kill or server shutdown).

I tried to output more information and found that when typing '@', XkbStateMods did not correctly retrieve the Shift state, causing a remapped key to be used to produce '@'.Partial output is as follows:

Wed Nov 20 16:28:10 2024
 XDesktop:    keycode 0 , xtcode 0, keysym 0xffe1, Shift_L
 XDesktop:    XkbTranslateKeyCode mods 16,out_mods 0
 XDesktop:    XkbTranslateKeyCode keycode 0x0008,cursym 0x0000,keysym 0xffe1
 XDesktop:    XkbTranslateKeyCode keycode '(null)',cursym '(null)',keysym'Shift_L'
        .
        .
        .
        .
 XDesktop:    XkbTranslateKeyCode mods 16,out_mods 1
 XDesktop:    XkbTranslateKeyCode keycode 0x0031,cursym 0x0060,keysym 0xffe1
 XDesktop:    XkbTranslateKeyCode keycode '1',cursym 'grave',keysym 'Shift_L'
 XDesktop:    XkbTranslateKeyCode mods 16,out_mods 0
 XDesktop:    XkbTranslateKeyCode keycode 0x0032,cursym 0xffe1,keysym 0xffe1
 XDesktop:    XkbTranslateKeyCode keycode '2',cursym 'Shift_L',keysym 'Shift_L'
 XDesktop:    XkbKeysymToKeycode keycode '50'
 XDesktop:    keycode 0 , xtcode 0, keysym 0x0040, at
 XDesktop:    XkbTranslateKeyCode mods 16,out_mods 0
 XDesktop:    XkbTranslateKeyCode keycode 0x0008,cursym 0x0000,keysym 0x0040
 XDesktop:    XkbTranslateKeyCode keycode '(null)',cursym '(null)',keysym 'at'
        .
        .
        .
        .
 XDesktop:    XkbTranslateKeyCode mods 16,out_mods 0
 XDesktop:    XkbTranslateKeyCode keycode 0x00ff,cursym 0x1008ffb5,keysym 0x0040
 XDesktop:    XkbTranslateKeyCode keycode 'ydiaeresis',cursym 'XF86RFKill',keysym 'at'
 XDesktop:    XkbKeysymToKeycode keycode '256'
 XDesktop:    Added unknown keysym XK_at (0x0040) to keycode 253

I can only try to make the following judgment after the XkbTranslateKeyCode loop ends (keycode == 0 && !(mods & ShiftMask)), then set mods |= ShiftMask, and perform the XkbTranslateKeyCode loop once again.

TigerVNC Server version 1.14.80, built Nov 21 2024 08:58:52
4.19.71-arm64-desktop #52.57030 SMP PREEMPT Mon Jan 9 15:36:53 CST 2023 aarch64 GNU/Linux
CPU Kirin990