[PATCH 08/19] Xephyr: replace XKeycodeToKeysym with xcb-keysyms

Julien Cristau jcristau at debian.org
Wed Oct 20 10:11:50 PDT 2010


Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 configure.ac            |    2 +-
 hw/kdrive/ephyr/hostx.c |   11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index c91b716..9a1ee42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2061,7 +2061,7 @@ if test "$KDRIVE" = yes; then
        AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
     fi
 
-    XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xau xdmcp xcb x11-xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm"
+    XEPHYR_REQUIRED_LIBS="x11 $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 a09ba36..1491f53 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>
@@ -990,6 +991,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))
     {
@@ -1058,9 +1063,9 @@ hostx_get_event(EphyrHostXEvent *ev)
 	  }
 	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.7.1



More information about the xorg-devel mailing list