[PATCH xserver 4/4] input: support the new XIScrollClass to mark axes as scrolling axes
Peter Hutterer
peter.hutterer at who-t.net
Thu Sep 22 15:18:52 PDT 2011
On Thu, Sep 22, 2011 at 11:13:30AM +0100, Daniel Stone wrote:
> 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.
it's also very broken, so probably wants fixing ;)
Cheers,
Peter
More information about the xorg-devel
mailing list