[PATCH xwayland] xwayland: implement repeat_info event

Marek Chalupa mchqwerty at gmail.com
Wed Aug 19 01:56:17 PDT 2015



On 08/17/2015 04:03 PM, Rui Tiago Cação Matos wrote:
> 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.

Yes, XkbDDXChangeControls() seems to have effect only when changing 
per-key repeating, so I think that it should be fine here.
Anyhow, it looks working.

>
>> +
>> +        XkbSetRepeatKeys(dev, -1, rate != 0);
>
> Should probably use the AutoRepeatModeOff/On definitions here instead
> of rate != 0.

True

Thanks,
Marek

>
> Rui
>


More information about the xorg-devel mailing list