[Spice-devel] [PATCH spice-gtk] vncdisplaykeymap: Use XkbGetMap and XkbGetNames instead of XkbGetKeyboard

Marc-André Lureau marcandre.lureau at gmail.com
Mon Feb 23 02:53:09 PST 2015


ack, and pushed

thanks

On Fri, Feb 20, 2015 at 4:19 PM, Pavel Grunt <pgrunt at redhat.com> wrote:
> XkbGetKeyboard does not work in XWayland (bfo#89240).
>
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=89105
> ---
> According to the discussion http://lists.freedesktop.org/archives/spice-devel/2015-February/018964.html I submitted bfo#89240,
> which was closed with the advise to use XkbGetMap. This solution doesn't rely on an environment variable and works in XWayland.
> ---
>  gtk/vncdisplaykeymap.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/gtk/vncdisplaykeymap.c b/gtk/vncdisplaykeymap.c
> index 340a86f..6bf351f 100644
> --- a/gtk/vncdisplaykeymap.c
> +++ b/gtk/vncdisplaykeymap.c
> @@ -175,11 +175,12 @@ const guint16 *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window,
>                  * X servers..... patches welcomed.
>                  */
>
> -               desc = XkbGetKeyboard(gdk_x11_display_get_xdisplay(dpy),
> +               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");
> @@ -195,11 +196,11 @@ const guint16 *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window,
>                         VNC_DEBUG("Using xquartz keycode mapping");
>                         *maplen = G_N_ELEMENTS(keymap_xorgxquartz2xtkbd);
>                         return keymap_xorgxquartz2xtkbd;
> -               } else if (keycodes && STRPREFIX(keycodes, "evdev_")) {
> +               } else if (keycodes && STRPREFIX(keycodes, "evdev")) {
>                         VNC_DEBUG("Using evdev keycode mapping");
>                         *maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd);
>                         return keymap_xorgevdev2xtkbd;
> -               } else if (keycodes && STRPREFIX(keycodes, "xfree86_")) {
> +               } else if (keycodes && STRPREFIX(keycodes, "xfree86")) {
>                         VNC_DEBUG("Using xfree86 keycode mapping");
>                         *maplen = G_N_ELEMENTS(keymap_xorgkbd2xtkbd);
>                         return keymap_xorgkbd2xtkbd;
> --
> 2.3.0
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list