From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAG5u-0001oc-Vc for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:45:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAG5n-0007TO-Hx for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:45:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAG5n-0007TE-8T for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:45:27 -0500 Message-ID: <52EF6530.9090607@redhat.com> Date: Mon, 03 Feb 2014 10:45:20 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1390903055-479-1-git-send-email-kraxel@redhat.com> <1390903055-479-21-git-send-email-kraxel@redhat.com> <52EC2250.5050105@redhat.com> <1391420536.23350.43.camel@nilsson.home.kraxel.org> In-Reply-To: <1391420536.23350.43.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, Anthony Liguori Il 03/02/2014 10:42, Gerd Hoffmann ha scritto: > 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? Because otherwise both axes become X. When the first if triggers the axis changes to Y, and then it becomes X again. :) >>> + 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? In what sense it is not used? Because you do not have e.g. a USB controller in the only machines that support graphic_rotate? Paolo >> >> 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 > >