From 45e85c8864f9cfa4984626d4bc0050bb6c5e9d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Mon, 12 Apr 2021 13:25:10 +0000 Subject: [PATCH] use exact XkbKeysymToKeycode from tigervnc. --- internal/desktop/xorg/xorg.c | 8 ++++---- internal/desktop/xorg/xorg.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/desktop/xorg/xorg.c b/internal/desktop/xorg/xorg.c index 02cffd47..bc545c46 100644 --- a/internal/desktop/xorg/xorg.c +++ b/internal/desktop/xorg/xorg.c @@ -109,11 +109,11 @@ KeyCode XKeyEntryGet(KeySym keysym) { } // From https://github.com/TigerVNC/tigervnc/blob/0946e298075f8f7b6d63e552297a787c5f84d27c/unix/x0vncserver/XDesktop.cxx#L343-L379 -KeyCode KbdXKeysymToKeycode(Display *dpy, KeySym keysym) { +KeyCode XkbKeysymToKeycode(Display* dpy, KeySym keysym) { XkbDescPtr xkb; XkbStateRec state; unsigned int mods; - KeyCode keycode; + unsigned keycode; xkb = XkbGetMap(dpy, XkbAllComponentsMask, XkbUseCoreKbd); if (!xkb) @@ -142,7 +142,7 @@ KeyCode KbdXKeysymToKeycode(Display *dpy, KeySym keysym) { // Shift+Tab is usually ISO_Left_Tab, but RFB hides this fact. Do // another attempt if we failed the initial lookup if ((keycode == 0) && (keysym == XK_Tab) && (mods & ShiftMask)) - return KbdXKeysymToKeycode(dpy, XK_ISO_Left_Tab); + return XkbKeysymToKeycode(dpy, XK_ISO_Left_Tab); return keycode; } @@ -158,7 +158,7 @@ void XKey(KeySym keysym, int down) { keycode = XKeyEntryGet(keysym); if (keycode == 0) - keycode = KbdXKeysymToKeycode(display, keysym); + keycode = XkbKeysymToKeycode(display, keysym); // Map non-existing keysyms to new keycodes if (keycode == 0) { diff --git a/internal/desktop/xorg/xorg.h b/internal/desktop/xorg/xorg.h index fac230e5..f5ebd399 100644 --- a/internal/desktop/xorg/xorg.h +++ b/internal/desktop/xorg/xorg.h @@ -28,7 +28,7 @@ typedef struct xkeyentry_t { static void XKeyEntryAdd(KeySym keysym, KeyCode keycode); static KeyCode XKeyEntryGet(KeySym keysym); -static KeyCode KbdXKeysymToKeycode(Display *dpy, KeySym keysym); +static KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym); void XKey(KeySym keysym, int down); void XGetScreenConfigurations();