[PATCH gtk-vnc] vncdisplaykeymap: Use XkbGetMap and XkbGetNames instead of XkbGetKeyboard



XkbGetKeyboard does not work in XWayland (bfo#89240).

Copied from spice-gtk: 95e322a6bbc29dc9c28724fb80706464e276b89f
---
Hi, I know that gtk-vnc is already working in XWayland, but the check for XWayland relies on the environment 
variable "WAYLAND_DISPLAY".
We solved the "XWayland keymap issue" in spice-gtk by using XkbGetMap and XkbGetNames instead of 
XkbGetKeyboard.
---
 src/vncdisplaykeymap.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/vncdisplaykeymap.c b/src/vncdisplaykeymap.c
index 92cda37..4f076ce 100644
--- a/src/vncdisplaykeymap.c
+++ b/src/vncdisplaykeymap.c
@@ -187,11 +187,12 @@ const guint16 *vnc_display_keymap_gdk2rfb_table(size_t *maplen)
          * X servers..... patches welcomed.
          */
 
-        desc = XkbGetKeyboard(gdk_x11_display_get_xdisplay(dpy),
-                              XkbGBN_AllComponentsMask,
-                              XkbUseCoreKbd);
+        Display *xdisplay = gdk_x11_display_get_xdisplay(dpy);
+        desc = XkbGetMap(xdisplay,
+                         XkbGBN_AllComponentsMask,
+                         XkbUseCoreKbd);
         if (desc) {
-            if (desc->names) {
+            if (XkbGetNames(xdisplay, XkbKeycodesNameMask, desc) == Success) {
                 keycodes = gdk_x11_get_xatom_name(desc->names->keycodes);
                 if (!keycodes)
                     g_warning("could not lookup keycode name");
@@ -217,11 +218,11 @@ const guint16 *vnc_display_keymap_gdk2rfb_table(size_t *maplen)
             VNC_DEBUG("Using wayland evdec keycode mapping");
             *maplen = G_N_ELEMENTS(keymap_xorgevdev2rfb);
             return keymap_xorgevdev2rfb;
-        } else if (keycodes && STRPREFIX(keycodes, "evdev_")) {
+        } else if (keycodes && STRPREFIX(keycodes, "evdev")) {
             VNC_DEBUG("Using evdev keycode mapping");
             *maplen = G_N_ELEMENTS(keymap_xorgevdev2rfb);
             return keymap_xorgevdev2rfb;
-        } else if (keycodes && STRPREFIX(keycodes, "xfree86_")) {
+        } else if (keycodes && STRPREFIX(keycodes, "xfree86")) {
             VNC_DEBUG("Using xfree86 keycode mapping");
             *maplen = G_N_ELEMENTS(keymap_xorgkbd2rfb);
             return keymap_xorgkbd2rfb;
-- 
2.3.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]