From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnYkV-0003pP-UM for qemu-devel@nongnu.org; Mon, 02 Dec 2013 14:01:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnYkM-0005L6-Kj for qemu-devel@nongnu.org; Mon, 02 Dec 2013 14:01:39 -0500 Received: from maverick.spineless.org ([71.174.98.242]:48535 helo=spineless.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnYkM-0005II-Gf for qemu-devel@nongnu.org; Mon, 02 Dec 2013 14:01:30 -0500 Received: from [216.57.91.130] (helo=[10.204.240.225]) by spineless.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1VnYkF-00027D-BD for qemu-devel@nongnu.org; Mon, 02 Dec 2013 14:01:23 -0500 Message-ID: <529CD8EB.5030403@spineless.org> Date: Mon, 02 Dec 2013 14:00:59 -0500 From: John Baboval MIME-Version: 1.0 References: <1385649010-7034-1-git-send-email-kraxel@redhat.com> <1385649010-7034-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1385649010-7034-12-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 11/15] input: mouse: add graphic_rotate support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I'm not sure this is correct. Generally when the display gets rotated, the input device coordinates do not, and the in-guest code handles the math. On 11/28/2013 09:30 AM, Gerd Hoffmann wrote: > Transform absolute mouse events according to graphic_rotate. > > Legacy input code does it for both absolute and relative events, > but the logic is broken for relative coordinates, so this is > most likely not used anyway. > > Signed-off-by: Gerd Hoffmann > --- > ui/input.c | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/ui/input.c b/ui/input.c > index fa6d677..abfe3a3 100644 > --- a/ui/input.c > +++ b/ui/input.c > @@ -50,6 +50,33 @@ qemu_input_find_handler(uint32_t mask) > return NULL; > } > > +static void qemu_input_transform_abs_rotate(InputEvent *evt) > +{ > + 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) { > + evt->abs->axis = INPUT_AXIS_X; > + evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis; > + } > + break; > + case 180: > + evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis; > + break; > + case 270: > + if (evt->abs->axis == INPUT_AXIS_X) { > + evt->abs->axis = INPUT_AXIS_Y; > + evt->abs->axis = INPUT_EVENT_ABS_SIZE - 1 - evt->abs->axis; > + } > + if (evt->abs->axis == INPUT_AXIS_Y) { > + evt->abs->axis = INPUT_AXIS_X; > + } > + break; > + } > +} > + > void qemu_input_event_send(QemuConsole *src, InputEvent *evt) > { > QemuInputHandlerState *s; > @@ -58,6 +85,12 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt) > return; > } > > + /* pre processing */ > + if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) { > + qemu_input_transform_abs_rotate(evt); > + } > + > + /* send event */ > s = qemu_input_find_handler(1 << evt->kind); > s->handler->event(s->dev, src, evt); > s->events++;