[PATCH xserver 4/4] input: support the new XIScrollClass to mark axes as scrolling axes

Daniel Stone daniel at fooishbar.org
Thu Sep 22 03:13:30 PDT 2011


Hi,

On Mon, Aug 22, 2011 at 03:35:27PM +1000, Peter Hutterer wrote:
> +    if (*current_ax != -1 && axnum != *current_ax)
> +    {
> +        ax = &dev->valuator->axes[*current_ax];
> +        if (ax->scroll.type == type && (flags & SCROLL_FLAG_PREFERRED) == (ax->scroll.flags & SCROLL_FLAG_PREFERRED))
> +            return FALSE;
> +    }

Very long line.

> +    switch(axis->scroll.type)
> +    {
> +        case SCROLL_TYPE_VERTICAL: info->scroll_type = XIScrollTypeVertical; break;
> +        case SCROLL_TYPE_HORIZONTAL: info->scroll_type = XIScrollTypeHorizontal; break;
> +        default:
> +            ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", axis->scroll.type);
> +            break;
> +    }

Ugh, style!

> +    while (fabs(delta) >= fabs(incr))
> +    {
> +        int b = ax->scroll.type == SCROLL_TYPE_VERTICAL ? 4 : 6;
> +        [...]
> +        else if (delta >= incr) {
> +            delta -= incr;
> +            b++;
> +        }

This is very clever, but subtle, so probably wants a comment.

Cheers,
Daniel


More information about the xorg-devel mailing list