vaapisink: fix GstNavigation "key-press" / "key-release" events.

Fix arguments to XkbKeycodeToKeysym() for converting an X11 keycode
to a KeySym. In particular, there is no such Window argument. Also
make sure to check for, and use, the correct <X11/XKBlib.h> header
where that new function is defined. Otherwise, default to the older
XKeycodeToKeysym() function.
This commit is contained in:
Gwenole Beauchesne 2014-09-24 13:39:55 +02:00
parent 039244bf77
commit 48e5bcbe7b
2 changed files with 25 additions and 2 deletions

View file

@ -559,6 +559,16 @@ if test "$enable_x11" = "yes"; then
fi
fi
dnl Check for XKB library
HAVE_XKBLIB=0
if test $USE_X11 -eq 1; then
AC_CHECK_HEADERS([X11/XKBlib.h], [HAVE_XKBLIB=1], [:])
fi
if test $HAVE_XKBLIB -eq 1; then
AC_DEFINE_UNQUOTED([HAVE_XKBLIB], 1,
[Defined to 1 if the XKB extension exists.])
fi
dnl Check for XRandR
HAVE_XRANDR=0
if test $USE_X11 -eq 1; then

View file

@ -218,6 +218,20 @@ gst_vaapisink_backend_drm (void)
#include <gst/vaapi/gstvaapidisplay_x11.h>
#include <gst/vaapi/gstvaapiwindow_x11.h>
#if HAVE_XKBLIB
# include <X11/XKBlib.h>
#endif
static inline KeySym
x11_keycode_to_keysym (Display * dpy, unsigned int kc)
{
#if HAVE_XKBLIB
return XkbKeycodeToKeysym (dpy, kc, 0, 0);
#else
return XKeycodeToKeysym (dpy, kc, 0);
#endif
}
/* Checks whether a ConfigureNotify event is in the queue */
typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs;
struct _ConfigureNotifyEventPendingArgs
@ -387,8 +401,7 @@ gst_vaapisink_x11_handle_events (GstVaapiSink * sink)
case KeyPress:
case KeyRelease:
gst_vaapi_display_lock (display);
keysym = XkbKeycodeToKeysym (x11_dpy, x11_win,
e.xkey.keycode, 0, 0);
keysym = x11_keycode_to_keysym (x11_dpy, e.xkey.keycode);
if (keysym != NoSymbol) {
key_str = XKeysymToString (keysym);
} else {