[PATCH kdrive/ephyr v2] kdrive/ephyr: map host X server's keymap into Xephyr, if supported

Adam Jackson ajax at nwnk.net
Thu Feb 25 19:07:56 UTC 2016


On Thu, 2016-02-25 at 07:10 -0300, Laércio de Sousa wrote:

> diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
> index a272882..fa76765 100644
> --- a/hw/kdrive/ephyr/ephyr.c
> +++ b/hw/kdrive/ephyr/ephyr.c
> @@ -47,7 +47,6 @@ extern Bool ephyr_glamor;
>  
>  KdKeyboardInfo *ephyrKbd;
>  KdPointerInfo *ephyrMouse;
> -EphyrKeySyms ephyrKeySyms;
>  Bool ephyrNoDRI = FALSE;
>  Bool ephyrNoXV = FALSE;
>  
> @@ -1291,16 +1290,35 @@ KdPointerDriver EphyrMouseDriver = {
>  static Status
>  EphyrKeyboardInit(KdKeyboardInfo * ki)
>  {
> +    int i;

Unused variable.

> +    KeySymsRec keySyms;
> +    CARD8 modmap[MAP_LENGTH];
> +    XkbControlsRec controls;
> +
>      ki->driverPrivate = (EphyrKbdPrivate *)
>          calloc(sizeof(EphyrKbdPrivate), 1);
> -    hostx_load_keymap();
> -    if (!ephyrKeySyms.minKeyCode) {
> +
> +    if (hostx_load_keymap(&keySyms, modmap, &controls)) {
> +        XkbApplyMappingChange(ki->dixdev, &keySyms,
> +                              keySyms.minKeyCode,
> +                              keySyms.maxKeyCode - keySyms.minKeyCode + 1,
> +                              modmap, serverClient);
> +        XkbDDXChangeControls(ki->dixdev, &controls, &controls);
> +        free(keySyms.map);
> +    }
> +
> +    if (!keySyms.minKeyCode) {
>          ErrorF("Couldn't load keymap from host\n");
>          return BadAlloc;
>      }

I don't think this can ever be triggered? hostx_load_keymap initializes
minKeyCode based on the initial connection block before doing anything
else, and it'll never be 0 because the X protocol guarantees it's >= 8.

I suppose that's not your fault, the current code is broken in the same
way. Still probably best to just delete that conditional, if we ever
run against a non-XKB server we might as well try to stumble through.

> diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
> index 3a1c6a0..00ef4d0 100644
> --- a/hw/kdrive/src/kinput.c
> +++ b/hw/kdrive/src/kinput.c
> @@ -747,10 +747,6 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
>              return BadImplementation;
>          }
>  
> -        if ((*ki->driver->Init) (ki) != Success) {
> -            return !Success;
> -        }
> -
>          memset(&rmlvo, 0, sizeof(rmlvo));
>          rmlvo.rules = ki->xkbRules;
>          rmlvo.model = ki->xkbModel;
> @@ -763,6 +759,10 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
>              return BadImplementation;
>          }
>  
> +        if ((*ki->driver->Init) (ki) != Success) {
> +            return !Success;
> +        }
> +
>          xiclass = AtomFromName(XI_KEYBOARD);
>          AssignTypeAndName(pDevice, xiclass,
>                            ki->name ? ki->name : "Generic KDrive Keyboard");

This seems like it clobbers whatever you'd have passed in from the
command line (in patch 2/4 of your other series). Am I reading that
right? What's the desired result here?

- ajax


More information about the xorg-devel mailing list