Received: from eggs.gnu.org ([140.186.70.92]:50038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgXhK-0007Zc-40 for qemu-devel@nongnu.org; Tue, 12 Jul 2011 03:48:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgXhI-0001hP-0p for qemu-devel@nongnu.org; Tue, 12 Jul 2011 03:48:01 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:39093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgXhH-0001hA-CC for qemu-devel@nongnu.org; Tue, 12 Jul 2011 03:47:59 -0400 Message-ID: <4E1BFC24.3000508@web.de> Date: Tue, 12 Jul 2011 09:47:48 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4E049EB7.4010309@siemens.com> <0A671AC2-4669-462A-A704-12D94A3D5ACB@web.de> <4E05DAAC.7040905@web.de> <9B636835-1A44-4B01-A92D-7CECD3039669@web.de> <4E06F7C1.30507@web.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Sender: jan.kiszka@web.de Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2] usb-hid: Fix 0/0 position for Windows in tablet mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: andrzej zaborowski Cc: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel , Gerd Hoffmann On 2011-07-04 20:15, andrzej zaborowski wrote: > On 26 June 2011 11:11, Jan Kiszka wrote: >> On 2011-06-25 15:10, Andreas F=C3=A4rber wrote: >>> Am 25.06.2011 um 14:55 schrieb Jan Kiszka: >>> >>>> On 2011-06-25 14:37, Andreas F=C3=A4rber wrote: >>>>> Am 24.06.2011 um 16:27 schrieb Jan Kiszka: >>>>> >>>>>> For unknown reasons, Windows drivers (tested with XP and Win7) ign= ore >>>>>> usb-tablet events that move the pointer to 0/0. So always set bit = 0 of >>>>>> the coordinates. >>>>>> >>>>>> Signed-off-by: Jan Kiszka >>>>>> --- >>>>>> hw/usb-hid.c | 6 ++++-- >>>>>> 1 files changed, 4 insertions(+), 2 deletions(-) >>>>>> >>>>>> diff --git a/hw/usb-hid.c b/hw/usb-hid.c >>>>>> index d711b5c..2b9a451 100644 >>>>>> --- a/hw/usb-hid.c >>>>>> +++ b/hw/usb-hid.c >>>>>> @@ -457,8 +457,10 @@ static void >>>>>> usb_pointer_event_combine(USBPointerEvent *e, int xyrel, >>>>>> e->xdx +=3D x1; >>>>>> e->ydy +=3D y1; >>>>>> } else { >>>>>> - e->xdx =3D x1; >>>>>> - e->ydy =3D y1; >>>>>> + /* Windows drivers do not like the 0/0 position and ignor= e >>>>>> such >>>>>> + * events. */ >>>>>> + e->xdx =3D x1 | 1; >>>>>> + e->ydy =3D y1 | 1; >>>>> >>>>> Doesn't this change mean we can't access any other even pixel eithe= r? >>>> >>>> Only on 32767x32767 screens (that's the resolution of the tablet). >>> >>> Well, if it's just a fix for 0/0 I would've expected something like: >>> >>> e->xdx =3D x1 ? x1 : 1; >>> e->ydy =3D y1 ? y1 : 1; >> >> Works as well, my version is a little bit simpler. But I don't mind, >> will post whatever is preferred to fix this. >=20 > Would it be enough to just do this for x or y, not both? Yes, looks like. Is this one better? Jan ----------8<--------- From: Jan Kiszka For unknown reasons, Windows drivers (tested with XP and Win7) ignore usb-tablet events that move the pointer to 0/0. So always report 0/0 as 1/0. Signed-off-by: Jan Kiszka --- hw/usb-hid.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/usb-hid.c b/hw/usb-hid.c index d711b5c..faf91c4 100644 --- a/hw/usb-hid.c +++ b/hw/usb-hid.c @@ -459,6 +459,11 @@ static void usb_pointer_event_combine(USBPointerEven= t *e, int xyrel, } else { e->xdx =3D x1; e->ydy =3D y1; + /* Windows drivers do not like the 0/0 position and ignore such + * events. */ + if (!(x1 | y1)) { + x1 =3D 1; + } } e->dz +=3D z1; } --=20 1.7.3.4