qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support
Date: Mon, 03 Feb 2014 10:42:16 +0100

  Hi,

> > +    switch (graphic_rotate) {
> > +    case 90:
> > +        if (evt->abs->axis == INPUT_AXIS_X) {
> > +            evt->abs->axis = INPUT_AXIS_Y;
> > +        }
> > +        if (evt->abs->axis == INPUT_AXIS_Y) {
> 
> Need else here, same for "case 270".

Why?

> > +            evt->abs->axis = INPUT_AXIS_X;
> > +            evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis;
> 
> ->value here, not ->axis.

Oops, indeed.

> It looks like doing it right for relative is easy:

But what is the point when this isn't used anyway?

> 
>      if (graphic_rotate == 0) {
>          return;
>      }
>      if (move->axis != INPUT_AXIS_X && move->axis != INPUT_AXIS_Y) {
>          return;
>      }
>      if ((graphic_rotate <= 180 && move->axis == INPUT_AXIS_X) ||
>          (graphic_rotate >= 180 && move->axis == INPUT_AXIS_Y)) {
>           if (kind == INPUT_EVENT_KIND_ABS) {
>               move->value = INPUT_EVENT_ABS_SIZE - 1 - move->value;
>           } else {
>               move->value = -move->value;
>           }
>      }
>      if (graphic_rotate == 90 || graphic_rotate == 270) {
>          move->axis ^= INPUT_AXIS_X ^ INPUT_AXIS_Y;
>      }

Saves a few lines but it's a bit harder to figure what is going on ...

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]