[PATCH 09/19] Xephyr: replace XKeycodeToKeysym with xcb-keysyms
Eric Anholt
eric at anholt.net
Mon Aug 26 13:20:53 PDT 2013
From: Julien Cristau <jcristau at debian.org>
Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Julien Cristau <jcristau at debian.org>
---
configure.ac | 2 +-
hw/kdrive/ephyr/hostx.c | 13 ++++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2c9585d..db7ef7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2116,7 +2116,7 @@ if test "$KDRIVE" = yes; then
AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
fi
- XEPHYR_REQUIRED_LIBS="x11 >= 1.6 $LIBXEXT xau xdmcp xcb x11-xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm"
+ XEPHYR_REQUIRED_LIBS="x11 >= 1.6 $LIBXEXT xau xdmcp xcb x11-xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms"
if test "x$XV" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
fi
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 1261487..4bcc902 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -62,6 +62,7 @@
#include <xcb/shm.h>
#include <xcb/xcb_image.h>
#include <xcb/shape.h>
+#include <xcb/xcb_keysyms.h>
#ifdef XF86DRI
#include <xcb/xf86dri.h>
#include <xcb/glx.h>
@@ -943,6 +944,10 @@ hostx_get_event(EphyrHostXEvent * ev)
{
XEvent xev;
static int grabbed_screen = -1;
+ static xcb_key_symbols_t *keysyms;
+
+ if (!keysyms)
+ keysyms = xcb_key_symbols_alloc(HostX.conn);
if (XPending(HostX.dpy)) {
XNextEvent(HostX.dpy, &xev);
@@ -1007,11 +1012,9 @@ hostx_get_event(EphyrHostXEvent * ev)
return 1;
}
case KeyRelease:
-
- if ((XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode, 0) == XK_Shift_L
- || XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode,
- 0) == XK_Shift_R)
- && (xev.xkey.state & ControlMask)) {
+ if ((xcb_key_symbols_get_keysym(keysyms,xev.xkey.keycode, 0) == XK_Shift_L
+ || xcb_key_symbols_get_keysym(keysyms,xev.xkey.keycode, 0) == XK_Shift_R)
+ && (xev.xkey.state & XCB_MOD_MASK_CONTROL)) {
struct EphyrHostScreen *host_screen =
host_screen_from_window(xev.xexpose.window);
--
1.8.4.rc3
More information about the xorg-devel
mailing list