[PATCH xwayland] xwayland: implement repeat_info event

Rui Tiago Cação Matos tiagomatos at gmail.com
Mon Aug 17 07:03:11 PDT 2015


On Mon, Aug 17, 2015 at 11:37 AM, Marek Chalupa <mchqwerty at gmail.com> wrote:
> +static void
> +keyboard_handle_repeat_info (void *data, struct wl_keyboard *keyboard,
> +                             int32_t rate, int32_t delay)
> +{
> +    struct xwl_seat *xwl_seat = data;
> +    DeviceIntPtr dev;
> +    XkbControlsPtr ctrl;
> +
> +    if (rate < 0 || delay < 0) {
> +       ErrorF("Wrong rate/delay: %d, %d\n", rate, delay);
> +       return;
> +    }
> +
> +    for (dev = inputInfo.devices; dev; dev = dev->next) {
> +        if (dev != xwl_seat->keyboard &&
> +            dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD))
> +            continue;
> +
> +       if (rate != 0) {
> +            ctrl = dev->key->xkbInfo->desc->ctrls;
> +            ctrl->repeat_delay = delay;
> +            /* rate is number of keys per second */
> +            ctrl->repeat_interval = 1000 / rate;
> +       }

Since we're not changing the per_key_repeat array we don't need to
call XkbDDXChangeControls() here but I'm not 100% sure.

> +
> +        XkbSetRepeatKeys(dev, -1, rate != 0);

Should probably use the AutoRepeatModeOff/On definitions here instead
of rate != 0.

Rui


More information about the xorg-devel mailing list