This commit introduces a function for changing the keyboard layout on the guest side. --- configure.ac | 2 ++ src/vdagent-x11.c | 15 +++++++++++++++ src/vdagent-x11.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac index 79905a8..a5916d1 100644 --- a/configure.ac +++ b/configure.ac @@ -126,6 +126,8 @@ if test x"$enable_static_uinput" = "xyes" ; then AC_DEFINE([WITH_STATIC_UINPUT], [1], [If defined, vdagentd will use a static uinput device] ) fi +AC_CHECK_HEADERS([X11/XKBlib.h]) + # If no CFLAGS are set, set some sane default CFLAGS if test "$ac_test_CFLAGS" != set; then DEFAULT_CFLAGS="-Wall -Werror -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4" diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c index 752b337..a33eef9 100644 --- a/src/vdagent-x11.c +++ b/src/vdagent-x11.c @@ -31,6 +31,8 @@ Calling XPending when-ever we return to the mainloop also ensures any pending writes are flushed. */ +#include <config.h> + #include <glib.h> #include <stdlib.h> #include <limits.h> @@ -40,6 +42,9 @@ #include <unistd.h> #include <X11/Xatom.h> #include <X11/Xlib.h> +#ifdef HAVE_X11_XKBLIB_H +#include <X11/XKBlib.h> +#endif #include <X11/extensions/Xfixes.h> #include "vdagentd-proto.h" #include "vdagent-x11.h" @@ -1352,3 +1357,13 @@ int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11) return 0; } + +void vdagent_x11_set_keyboard_description(struct vdagent_x11 *x11, + uint8_t *keyboard_desc) +{ +#ifdef HAVE_X11_XKBLIB_H + XkbComponentNamesRec comp = {.symbols = (char *) keyboard_desc}; + + XkbGetKeyboardByName(x11->display, XkbUseCoreKbd, &comp, XkbGBN_SymbolsMask, XkbGBN_SymbolsMask, True); +#endif +} diff --git a/src/vdagent-x11.h b/src/vdagent-x11.h index d64a42a..3a3f7c1 100644 --- a/src/vdagent-x11.h +++ b/src/vdagent-x11.h @@ -50,4 +50,7 @@ void vdagent_x11_client_disconnected(struct vdagent_x11 *x11); int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11); +void vdagent_x11_set_keyboard_description(struct vdagent_x11 *x11, + uint8_t *keyboard_desc); + #endif -- 1.9.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel