From ca3eb5abeb187a1e40ff7c36bf87d52efb999be9 Mon Sep 17 00:00:00 2001 From: Vinay Bondhugula Date: Sat, 19 Jan 2008 09:07:16 -0800 Subject: Fix an old sign bug for the relative mode Higher order bits for the X and Y inputs (which could be set in case of a relative mouse) were being zeroed off in VMMouseClient_GetInput. This change fixes it. --- src/vmmouse_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vmmouse_client.c b/src/vmmouse_client.c index 5f27e54..f34c223 100644 --- a/src/vmmouse_client.c +++ b/src/vmmouse_client.c @@ -267,9 +267,11 @@ VMMouseClient_GetInput (PVMMOUSE_INPUT_DATA pvmmouseInput) { pvmmouseInput->Flags = (packetInfo & 0xffff0000) >> 16; pvmmouseInput->Buttons = (packetInfo & 0x0000ffff); - pvmmouseInput->X = vmpc.out.vEbx & 0xffff; - pvmmouseInput->Y = vmpc.out.vEcx & 0xffff; + /* Note that Z is always signed, and X/Y are signed in relative mode. */ + pvmmouseInput->X = (int)vmpc.out.vEbx; + pvmmouseInput->Y = (int)vmpc.out.vEcx; pvmmouseInput->Z = (int)vmpc.out.vEdx; + /* * Return number of packets (including this one) in queue. */ -- cgit v1.2.3