[Xcb] [PATCH 17/19] Xephyr: stop loading the host's keymap

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


This isn't used anywhere.

Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 hw/kdrive/ephyr/ephyr.c |    2 +-
 hw/kdrive/ephyr/hostx.c |   36 +-----------------------------------
 hw/kdrive/ephyr/hostx.h |    3 ---
 3 files changed, 2 insertions(+), 39 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 8096a24..3cffeaf 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -1100,7 +1100,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki)
   ki->driverPrivate = (EphyrKbdPrivate *)
                        calloc(sizeof(EphyrKbdPrivate), 1);
   hostx_load_keymap();
-  if (!ephyrKeySyms.map) {
+  if (!ephyrKeySyms.minKeyCode) {
       ErrorF("Couldn't load keymap from host\n");
       return BadAlloc;
   }
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index d054a40..0dd5105 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -921,49 +921,15 @@ hostx_paint_debug_rect (struct EphyrHostScreen *host_screen,
 void
 hostx_load_keymap(void)
 {
-  xcb_keysym_t *keymap;
-  int              host_width, min_keycode, max_keycode, width;
-  int              i,j;
-  xcb_get_keyboard_mapping_cookie_t cookie;
-  xcb_get_keyboard_mapping_reply_t *reply;
+  int              min_keycode, max_keycode;
 
   min_keycode = xcb_get_setup(HostX.conn)->min_keycode;
   max_keycode = xcb_get_setup(HostX.conn)->max_keycode;
 
   EPHYR_DBG ("min: %d, max: %d", min_keycode, max_keycode);
 
-  cookie = xcb_get_keyboard_mapping(HostX.conn,
-                                    min_keycode,
-                                    max_keycode - min_keycode + 1);
-  reply = xcb_get_keyboard_mapping_reply(HostX.conn, cookie, NULL);
-  host_width = reply->keysyms_per_keycode;
-  keymap = xcb_get_keyboard_mapping_keysyms(reply);
-
-  /* Try and copy the hosts keymap into our keymap to avoid loads
-   * of messing around.
-   *
-   * kdrive cannot can have more than 4 keysyms per keycode
-   * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 )
-   */
-  width = (host_width > 4) ? 4 : host_width;
-
-  ephyrKeySyms.map = (CARD32 *)calloc(sizeof(CARD32),
-                                      (max_keycode - min_keycode + 1) *
-                                      width);
-  if (!ephyrKeySyms.map)
-        return;
-
-  for (i=0; i<(max_keycode - min_keycode+1); i++)
-    for (j=0; j<width; j++)
-      ephyrKeySyms.map[(i*width)+j] = (CARD32) keymap[(i*host_width) + j];
-
-  EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
-
   ephyrKeySyms.minKeyCode  = min_keycode;
   ephyrKeySyms.maxKeyCode  = max_keycode;
-  ephyrKeySyms.mapWidth    = width;
-
-  free(reply);
 }
 
 static struct EphyrHostScreen *
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 22a639f..052ce5a 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -53,12 +53,9 @@ typedef enum EphyrHostXEventType
 } 
 EphyrHostXEventType;
 
-/* I can't believe it's not a KeySymsRec. */
 typedef struct {
   int             minKeyCode;
   int             maxKeyCode;
-  int             mapWidth;
-  CARD32         *map;
 } EphyrKeySyms;
 
 struct EphyrHostXEvent
-- 
1.7.1



More information about the Xcb mailing list