diff options
-rw-r--r-- | src/mouse.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mouse.c b/src/mouse.c index 0cbca6f..53924f1 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -1,4 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.79 2003/11/03 05:11:48 tsi Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.80 2003/12/08 23:49:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.80 2003/12/08 23:49:42 dawes Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -1388,7 +1389,11 @@ MouseReadInput(InputInfoPtr pInfo) (pBuf[0] & 0x80) >> 3; /* button 5 */ dx = (pBuf[0] & 0x10) ? pBuf[1]-256 : pBuf[1]; dy = (pBuf[0] & 0x20) ? -(pBuf[2]-256) : -pBuf[2]; - dz = (char)(pBuf[3] | ((pBuf[3] & 0x08) ? 0xf8 : 0)); + /* + * The next cast must be 'signed char' for platforms (like PPC) + * where char defaults to unsigned. + */ + dz = (signed char)(pBuf[3] | ((pBuf[3] & 0x08) ? 0xf8 : 0)); if ((pBuf[3] & 0xf8) && ((pBuf[3] & 0xf8) != 0xf8)) { if (pMse->autoProbe) { SetMouseProto(pMse, PROT_EXPPS2); @@ -1498,6 +1503,10 @@ MouseReadInput(InputInfoPtr pInfo) dy = - ((char)(pBuf[2]) + (char)(pBuf[4])); /* FreeBSD sysmouse sends additional data bytes */ if (pMse->protoPara[4] >= 8) { + /* + * These casts must be 'signed char' for platforms (like PPC) + * where char defaults to unsigned. + */ dz = ((signed char)(pBuf[5] << 1) + (signed char)(pBuf[6] << 1)) >> 1; buttons |= (int)(~pBuf[7] & 0x7f) << 3; |