Xephyr: stop loading the host's keymap

This isn't used anywhere.

v2: Rebase to the top of the patch series (anholt)

Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> (v1)
Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Julien Cristau 2010-06-25 17:59:13 +01:00 committed by Eric Anholt
parent 94d4e29aed
commit 762606b4cd
3 changed files with 2 additions and 36 deletions

View File

@ -1091,7 +1091,7 @@ EphyrKeyboardInit(KdKeyboardInfo * ki)
ki->driverPrivate = (EphyrKbdPrivate *) ki->driverPrivate = (EphyrKbdPrivate *)
calloc(sizeof(EphyrKbdPrivate), 1); calloc(sizeof(EphyrKbdPrivate), 1);
hostx_load_keymap(); hostx_load_keymap();
if (!ephyrKeySyms.map) { if (!ephyrKeySyms.minKeyCode) {
ErrorF("Couldn't load keymap from host\n"); ErrorF("Couldn't load keymap from host\n");
return BadAlloc; return BadAlloc;
} }

View File

@ -840,45 +840,14 @@ hostx_paint_debug_rect(struct EphyrHostScreen *host_screen,
void void
hostx_load_keymap(void) hostx_load_keymap(void)
{ {
XID *keymap; int min_keycode, max_keycode;
int host_width, min_keycode, max_keycode, width;
int i, j;
XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode); XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode);
EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode); EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode);
keymap = XGetKeyboardMapping(HostX.dpy,
min_keycode,
max_keycode - min_keycode + 1, &host_width);
/* 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)
goto out;
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.minKeyCode = min_keycode;
ephyrKeySyms.maxKeyCode = max_keycode; ephyrKeySyms.maxKeyCode = max_keycode;
ephyrKeySyms.mapWidth = width;
out:
XFree(keymap);
} }
static struct EphyrHostScreen * static struct EphyrHostScreen *

View File

@ -51,12 +51,9 @@ typedef enum EphyrHostXEventType {
EPHYR_EV_CONFIGURE, EPHYR_EV_CONFIGURE,
} EphyrHostXEventType; } EphyrHostXEventType;
/* I can't believe it's not a KeySymsRec. */
typedef struct { typedef struct {
int minKeyCode; int minKeyCode;
int maxKeyCode; int maxKeyCode;
int mapWidth;
CARD32 *map;
} EphyrKeySyms; } EphyrKeySyms;
struct EphyrHostXEvent { struct EphyrHostXEvent {