summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-08-23 15:46:08 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-08-23 15:46:08 +0000
commit1dc0e4e5ba3c8a7b9cf0739229c4ea43bc91a797 (patch)
tree5bfd90bdbb589d76e02fc035f78abee8101de818 /driver
parent1cd06c9934bba135c31a14587439ee4067564645 (diff)
xf86-input-vmmouse 12.5.1
Diffstat (limited to 'driver')
-rw-r--r--driver/xf86-input-vmmouse/configure.ac13
-rw-r--r--driver/xf86-input-vmmouse/src/vmmouse.c259
-rw-r--r--driver/xf86-input-vmmouse/src/vmmouse_client.c6
-rw-r--r--driver/xf86-input-vmmouse/src/vmmouse_proto.h12
4 files changed, 186 insertions, 104 deletions
diff --git a/driver/xf86-input-vmmouse/configure.ac b/driver/xf86-input-vmmouse/configure.ac
index bf558be6b..a57851fed 100644
--- a/driver/xf86-input-vmmouse/configure.ac
+++ b/driver/xf86-input-vmmouse/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-vmmouse],
- 12.4.0,
+ 12.5.1,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-vmmouse)
@@ -75,9 +75,18 @@ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901] xproto $REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1] xproto $REQUIRED_MODULES)
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
+PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
+ [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,
+ [Has version 1.1.0 or greater of the Xserver])])
+
+PKG_CHECK_EXISTS([xorg-server >= 1.3.99.0 xorg-server <= 1.4.0.90],
+ [AC_DEFINE([CALL_CONVERSION_PROC], 1,
+ [Call conversion_proc from within the driver, as
+ Xserver doesn't])])
+
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
AC_SUBST([CFLAGS])
diff --git a/driver/xf86-input-vmmouse/src/vmmouse.c b/driver/xf86-input-vmmouse/src/vmmouse.c
index 5543c4ca7..1e2a1c9a0 100644
--- a/driver/xf86-input-vmmouse/src/vmmouse.c
+++ b/driver/xf86-input-vmmouse/src/vmmouse.c
@@ -32,11 +32,11 @@
*
* This is a modified version of the mouse input driver
* provided in Xserver/hw/xfree86/input/mouse/mouse.c
- *
+ *
* Although all data is read using the vmmouse protocol, notification
* is still done through the PS/2 port, so all the basic code for
* interacting with the port is retained.
- *
+ *
*/
@@ -77,11 +77,41 @@
#include "vmmouse_client.h"
/*
+ * This is the only way I know to turn a #define of an integer constant into
+ * a constant string.
+ */
+#define VMW_INNERSTRINGIFY(s) #s
+#define VMW_STRING(str) VMW_INNERSTRINGIFY(str)
+
+/*
+ * So that the file compiles unmodified when dropped into an xfree source tree.
+ */
+#ifndef XORG_VERSION_CURRENT
+#define XORG_VERSION_CURRENT XF86_VERSION_CURRENT
+#endif
+
+/*
* Version constants
*/
#define VMMOUSE_MAJOR_VERSION 12
-#define VMMOUSE_MINOR_VERSION 4
-#define VMMOUSE_PATCHLEVEL 0
+#define VMMOUSE_MINOR_VERSION 5
+#define VMMOUSE_PATCHLEVEL 1
+#define VMMOUSE_DRIVER_VERSION \
+ (VMMOUSE_MAJOR_VERSION * 65536 + VMMOUSE_MINOR_VERSION * 256 + VMMOUSE_PATCHLEVEL)
+#define VMMOUSE_DRIVER_VERSION_STRING \
+ VMW_STRING(VMMOUSE_MAJOR_VERSION) "." VMW_STRING(VMMOUSE_MINOR_VERSION) \
+ "." VMW_STRING(VMMOUSE_PATCHLEVEL)
+
+/*
+ * Standard four digit version string expected by VMware Tools installer.
+ * As the driver's version is only {major, minor, patchlevel}, simply append an
+ * extra zero for the fourth digit.
+ */
+#ifdef __GNUC__
+const char vm_mouse_version[] __attribute__((section(".modinfo"),unused)) =
+ "version=" VMMOUSE_DRIVER_VERSION_STRING ".0";
+#endif
+
/*****************************************************************************
* static function header
@@ -109,8 +139,8 @@ static void MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
*****************************************************************************/
typedef struct {
int screenNum;
- Bool vmmouseAvailable;
- Bool relative;
+ Bool vmmouseAvailable;
+ Bool relative;
} VMMousePrivRec, *VMMousePrivPtr;
static const char *reqSymbols[] = {
@@ -165,7 +195,7 @@ InputDriverRec VMMOUSE = {
"vmmouse",
NULL,
VMMousePreInit,
- VMMouseUnInit,
+ VMMouseUnInit,
NULL,
0
};
@@ -201,8 +231,8 @@ typedef enum {
/*
* Define the acceptable mouse options
* Currently not all of those options are supported
- *
- */
+ *
+ */
static const OptionInfoRec mouseOptions[] = {
{ OPTION_ALWAYS_CORE, "AlwaysCore", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SEND_CORE_EVENTS, "SendCoreEvents", OPTV_BOOLEAN, {0}, FALSE },
@@ -247,12 +277,12 @@ static char reverseMap[32] = { 0, 4, 2, 6, 1, 5, 3, 7,
* This function collect all the information that is necessary to
* determine the configuration of the hardware and to prepare the
* device for being used
- *
+ *
* Results:
* An InputInfoPtr object which points to vmmouse's information,
* if the absolute pointing device available
* Otherwise, an InputInfoPtr of regular mouse
- *
+ *
* Side effects:
* VMMouse was initialized with necessary information
*
@@ -261,7 +291,7 @@ static char reverseMap[32] = { 0, 4, 2, 6, 1, 5, 3, 7,
static InputInfoPtr
VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
-{
+{
InputInfoPtr pInfo;
MouseDevPtr pMse;
VMMousePrivPtr mPriv;
@@ -269,14 +299,14 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
/*
* let Xserver init the mouse first
- */
+ */
osInfo = xf86OSMouseInit(0);
if (!osInfo)
return FALSE;
-
+
mPriv = xcalloc (1, sizeof (VMMousePrivRec));
-
+
if (!mPriv) {
return NULL;
}
@@ -298,7 +328,7 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
} else {
return NULL;
}
-
+
} else {
/*
* vmmouse is available
@@ -309,21 +339,23 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
* Disable the absolute pointing device for now
* It will be enabled during DEVICE_ON phase
*/
- VMMouseClient_Disable();
+ VMMouseClient_Disable();
}
-
+
if (!(pInfo = xf86AllocateInput(drv, 0))) {
xfree(mPriv);
return NULL;
- }
+ }
/* Settup the pInfo */
- pInfo->name = dev->identifier;
+ pInfo->name = dev->identifier;
pInfo->type_name = XI_MOUSE;
pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS;
pInfo->device_control = VMMouseDeviceControl;
pInfo->read_input = VMMouseReadInput;
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
pInfo->motion_history_proc = xf86GetMotionEvents;
+#endif
pInfo->control_proc = VMMouseControlProc;
pInfo->close_proc = VMMouseCloseProc;
pInfo->switch_mode = VMMouseSwitchMode;
@@ -346,7 +378,7 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pMse->PostEvent = VMMousePostEvent;
pMse->CommonOptions = MouseCommonOptions;
pMse->mousePriv = mPriv;
-
+
/* Collect the options, and process the common options. */
xf86CollectInputOptions(pInfo, NULL, NULL);
@@ -368,13 +400,13 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
xf86CloseSerial(pInfo->fd);
pInfo->fd = -1;
-
+
/* Process the options */
pMse->CommonOptions(pInfo);
-
+
/* set up the current screen num */
mPriv->screenNum = xf86SetIntOption(pInfo->options, "ScreenNumber", 0);
-
+
pInfo->flags |= XI86_CONFIGURED;
return pInfo;
}
@@ -392,11 +424,11 @@ VMMouseAvailableOptions(void *unused)
*----------------------------------------------------------------------
*
* MouseCtrl --
- * Alter the control paramters for the mouse.
- *
+ * Alter the control paramters for the mouse.
+ *
* Results:
- * None
- *
+ * None
+ *
* Side effects:
* None
*
@@ -415,7 +447,7 @@ MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl)
#ifdef EXTMOUSEDEBUG
xf86Msg(X_INFO, "VMMOUSE(0): MouseCtrl pMse=%p\n", pMse);
#endif
-
+
pMse->num = ctrl->num;
pMse->den = ctrl->den;
pMse->threshold = ctrl->threshold;
@@ -427,10 +459,10 @@ MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl)
*
* VMMouseDoPostEvent --
* Post the mouse button event and mouse motion event to Xserver
- *
+ *
* Results:
* None
- *
+ *
* Side effects:
* Mouse location and button status was updated
*
@@ -444,7 +476,7 @@ VMMouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
VMMousePrivPtr mPriv;
int truebuttons;
int id, change;
-
+
pMse = pInfo->private;
mPriv = (VMMousePrivPtr)pMse->mousePriv;
@@ -452,15 +484,23 @@ VMMouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
* The following truebuttons/reverseBits and lastButtons are
* used to compare the current buttons and the previous buttons
* to find the button changes during two mouse events
- */
+ */
truebuttons = buttons;
buttons = reverseBits(reverseMap, buttons);
if (dx || dy) {
- xf86PostMotionEvent(pInfo->dev, !mPriv->relative, 0, 2, dx, dy);
+
+#ifdef CALL_CONVERSION_PROC
+ /*
+ * Xservers between 1.3.99.0 - 1.4.0.90 do not call conversion_proc, so
+ * we need to do the conversion from device to screen space.
+ */
+ VMMouseConvertProc(pInfo, 0, 2, dx, dy, 0, 0, 0, 0, &dx, &dy);
+#endif
+ xf86PostMotionEvent(pInfo->dev, !mPriv->relative, 0, 2, dx, dy);
}
-
+
if (truebuttons != pMse->lastButtons) {
change = buttons ^ reverseBits(reverseMap, pMse->lastButtons);
while (change) {
@@ -480,10 +520,10 @@ VMMouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
* VMMousePostEvent --
* Prepare the mouse status according to the Z axis mapping
* before we post the event to Xserver
- *
+ *
* Results:
* None
- *
+ *
* Side effects:
* Buttons was updated according to Z axis mapping
*
@@ -496,7 +536,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
MouseDevPtr pMse;
int zbutton = 0;
VMMousePrivPtr mPriv;
-
+
pMse = pInfo->private;
mPriv = (VMMousePrivPtr)pMse->mousePriv;
/* Map the Z axis movement. */
@@ -509,7 +549,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
if(mPriv->relative)
dx = dz;
else
- dx += dz;
+ dx += dz;
dz = 0;
}
break;
@@ -518,7 +558,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
if(mPriv->relative)
dy = dz;
else
- dy += dz;
+ dy += dz;
dz = 0;
}
break;
@@ -568,7 +608,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
*
* Results:
* None
- *
+ *
* Side effects:
* None
*
@@ -599,11 +639,11 @@ FlushButtons(MouseDevPtr pMse)
* MouseCommonOptions --
* Process acceptable mouse options. Currently we only process
* "Buttons" and "ZAxisMapping" options.
- * More options can be added later on
+ * More options can be added later on
*
* Results:
* None
- *
+ *
* Side effects:
* The buttons was setup according to the options
*
@@ -658,9 +698,9 @@ MouseCommonOptions(InputInfoPtr pInfo)
pMse->positiveZ = pMse->positiveW = 1 << (b2-1);
if (b1 > pMse->buttons) pMse->buttons = b1;
if (b2 > pMse->buttons) pMse->buttons = b2;
-
+
/*
- * Option "ZAxisMapping" "N1 N2 N3 N4" not supported
+ * Option "ZAxisMapping" "N1 N2 N3 N4" not supported
*/
pMse->negativeW = pMse->positiveW = MSE_NOZMAP;
} else {
@@ -681,7 +721,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
*/
if (origButtons != pMse->buttons)
from = X_CONFIG;
-
+
}
@@ -694,14 +734,14 @@ MouseCommonOptions(InputInfoPtr pInfo)
*
* Results:
* None
- *
+ *
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
-static void
+static void
VMMouseUnInit(InputDriverPtr drv, LocalDevicePtr local, int flags)
{
xf86Msg(X_INFO, "VMWARE(0): VMMouseUnInit\n");
@@ -713,12 +753,12 @@ VMMouseUnInit(InputDriverPtr drv, LocalDevicePtr local, int flags)
*
* VMMouseDeviceControl --
* This function was called by Xserver during DEVICE_INIT, DEVICE_ON,
- * DEVICE_OFF and DEVICE_CLOSE phase
- *
+ * DEVICE_OFF and DEVICE_CLOSE phase
+ *
* Results:
* TRUE, if sucessful
* FALSE, if failed
- *
+ *
* Side effects:
* Absolute pointing device is enabled during DEVICE_ON
* Absolute pointing device is disabled during DEVICE_OFF
@@ -735,11 +775,11 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
VMMousePrivPtr mPriv;
unsigned char map[MSE_MAXBUTTONS + 1];
int i;
-
+
pInfo = device->public.devicePrivate;
pMse = pInfo->private;
pMse->device = device;
- mPriv = (VMMousePrivPtr)pMse->mousePriv;
+ mPriv = (VMMousePrivPtr)pMse->mousePriv;
switch (mode){
case DEVICE_INIT:
@@ -753,8 +793,18 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
InitPointerDeviceStruct((DevicePtr)device, map,
min(pMse->buttons, MSE_MAXBUTTONS),
- miPointerGetMotionEvents, pMse->Ctrl,
- miPointerGetMotionBufferSize());
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
+ miPointerGetMotionEvents,
+#else
+ GetMotionHistory,
+#endif
+ pMse->Ctrl,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
+ miPointerGetMotionBufferSize()
+#else
+ GetMotionHistorySize(), 2
+#endif
+ );
/* X valuator */
xf86InitValuatorAxisStruct(device, 0, 0, -1, 1, 0, 1);
@@ -762,7 +812,9 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
/* Y valuator */
xf86InitValuatorAxisStruct(device, 1, 0, -1, 1, 0, 1);
xf86InitValuatorDefaults(device, 1);
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
xf86MotionHistoryAllocate(pInfo);
+#endif
xf86Msg(X_INFO, "VMWARE(0): VMMOUSE DEVICE_INIT\n");
#ifdef EXTMOUSEDEBUG
@@ -787,17 +839,17 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
/*
* enable absolute pointing device here
*/
- if (!VMMouseClient_Enable()) {
+ if (!VMMouseClient_Enable()) {
xf86Msg(X_ERROR, "VMWARE(0): vmmouse enable failed\n");
mPriv->vmmouseAvailable = FALSE;
device->public.on = FALSE;
return FALSE;
} else {
- mPriv->vmmouseAvailable = TRUE;
+ mPriv->vmmouseAvailable = TRUE;
VMMouseClient_RequestAbsolute();
mPriv->relative = FALSE;
xf86Msg(X_INFO, "VMWARE(0): vmmouse enabled\n");
- }
+ }
}
xf86FlushInput(pInfo->fd);
xf86AddEnabledDevice(pInfo);
@@ -806,7 +858,7 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
pMse->lastButtons = 0;
device->public.on = TRUE;
FlushButtons(pMse);
- break;
+ break;
case DEVICE_OFF:
case DEVICE_CLOSE:
xf86Msg(X_INFO, "VMWARE(0): VMMOUSE DEVICE_OFF/CLOSE\n");
@@ -817,7 +869,7 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
VMMouseClient_Disable();
mPriv->vmmouseAvailable = FALSE;
}
-
+
xf86RemoveEnabledDevice(pInfo);
if (pMse->buffer) {
XisbFree(pMse->buffer);
@@ -842,15 +894,15 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
* VMMouseReadInput --
* This function was called by Xserver when there is data available
* in the input device
- *
+ *
* Results:
* None
- *
+ *
* Side effects:
* Input data in regular PS/2 fd was cleared
* Real mouse data was read from the absolute pointing device
* and posted to Xserver
- *
+ *
*----------------------------------------------------------------------
*/
@@ -858,16 +910,16 @@ static void
VMMouseReadInput(InputInfoPtr pInfo)
{
MouseDevPtr pMse;
- VMMousePrivPtr mPriv;
+ VMMousePrivPtr mPriv;
int c;
- int len = 0;
+ int len = 0;
pMse = pInfo->private;
mPriv = pMse->mousePriv;
-
+
/*
* First read the bytes in input device to clear the regular PS/2 fd so
- * we don't get called again.
+ * we don't get called again.
*/
/*
* Set blocking to -1 on the first call because we know there is data to
@@ -880,10 +932,10 @@ VMMouseReadInput(InputInfoPtr pInfo)
len++;
/*
* regular PS packet consists of 3 bytes
- * We read 3 bytes to drain the PS/2 packet
+ * We read 3 bytes to drain the PS/2 packet
*/
if(len < 3) continue;
- len = 0;
+ len = 0;
/*
* Now get the real data from absolute pointing device
*/
@@ -902,14 +954,14 @@ VMMouseReadInput(InputInfoPtr pInfo)
* GetVMMouseMotionEvent --
* Read all the mouse data available from the absolute
* pointing device and post it to the Xserver
- *
+ *
* Results:
* None
- *
+ *
* Side effects:
* Real mouse data was read from the absolute pointing
* device and posted to Xserver
- *
+ *
*----------------------------------------------------------------------
*/
@@ -919,22 +971,31 @@ GetVMMouseMotionEvent(InputInfoPtr pInfo){
int buttons, dx, dy, dz, dw;
VMMOUSE_INPUT_DATA vmmouseInput;
int ps2Buttons = 0;
+ int numPackets;
+
+ pMse = pInfo->private;
+ while((numPackets = VMMouseClient_GetInput(&vmmouseInput))){
+ if (numPackets == VMMOUSE_ERROR) {
+ VMMouseClient_Disable();
+ VMMouseClient_Enable();
+ VMMouseClient_RequestAbsolute();
+ xf86Msg(X_INFO, "VMWARE(0): re-requesting absolute mode after reset\n");
+ break;
+ }
- pMse = pInfo->private;
- while(VMMouseClient_GetInput(&vmmouseInput)){
if(vmmouseInput.Buttons & VMMOUSE_MIDDLE_BUTTON)
ps2Buttons |= 0x04; /* Middle*/
if(vmmouseInput.Buttons & VMMOUSE_RIGHT_BUTTON)
ps2Buttons |= 0x02; /* Right*/
if(vmmouseInput.Buttons & VMMOUSE_LEFT_BUTTON)
ps2Buttons |= 0x01; /* Left*/
-
+
buttons = (ps2Buttons & 0x04) >> 1 | /* Middle */
(ps2Buttons & 0x02) >> 1 | /* Right */
(ps2Buttons & 0x01) << 2; /* Left */
-
+
dx = vmmouseInput.X;
- dy = vmmouseInput.Y;
+ dy = vmmouseInput.Y;
dz = (char)vmmouseInput.Z;
dw = 0;
/* post an event */
@@ -947,11 +1008,11 @@ GetVMMouseMotionEvent(InputInfoPtr pInfo){
*----------------------------------------------------------------------
*
* VMMouseControlProc --
- * This function is unused
+ * This function is unused
*
* Results:
* None
- *
+ *
* Side effects:
* None
*
@@ -970,11 +1031,11 @@ VMMouseControlProc(LocalDevicePtr local, xDeviceCtl * control)
*----------------------------------------------------------------------
*
* VMMouseCloseProc --
- * This function is unused
+ * This function is unused
*
* Results:
* None
- *
+ *
* Side effects:
* None
*
@@ -992,11 +1053,11 @@ VMMouseCloseProc(LocalDevicePtr local)
*----------------------------------------------------------------------
*
* VMMouseSwitchProc --
- * This function is unused
+ * This function is unused
*
* Results:
* None
- *
+ *
* Side effects:
* None
*
@@ -1016,13 +1077,13 @@ VMMouseSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
*
* VMMouseConvertProc --
* This function was called by Xserver to convert valuators to X and Y
- *
+ *
* Results:
* TRUE
- *
+ *
* Side effects:
* X and Y was converted according to current Screen dimension
- *
+ *
*----------------------------------------------------------------------
*/
@@ -1039,17 +1100,17 @@ VMMouseConvertProc(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v
if (first != 0 || num != 2)
return FALSE;
-
+
if(mPriv->relative) {
*x = v0;
*y = v1;
} else {
factorX = ((double) screenInfo.screens[mPriv->screenNum]->width) / (double) 65535;
factorY = ((double) screenInfo.screens[mPriv->screenNum]->height) / (double) 65535;
-
+
*x = v0 * factorX + 0.5;
*y = v1 * factorY + 0.5;
-
+
if (mPriv->screenNum != -1) {
xf86XInputSetScreen(pInfo, mPriv->screenNum, *x, *y);
}
@@ -1073,13 +1134,13 @@ ModuleInfoRec VMMouseInfo = {
*
* VMMouseUnplug --
* This function was called by Xserver when unplug
- *
+ *
* Results:
* None
- *
+ *
* Side effects:
* None
- *
+ *
*----------------------------------------------------------------------
*/
@@ -1095,16 +1156,16 @@ VMMouseUnplug(pointer p)
*
* VMMousePlug --
* This function was called when Xserver load vmmouse module. It will
- * integrate the module infto the XFree86 loader architecutre.
- *
+ * integrate the module infto the XFree86 loader architecutre.
+ *
* Results:
* TRUE
- *
+ *
* Side effects:
- * Regular mouse module was loaded as a submodule. In case
+ * Regular mouse module was loaded as a submodule. In case
* absolute pointing device is not available, we can always fall back
* to the regular mouse module
- *
+ *
*----------------------------------------------------------------------
*/
@@ -1118,7 +1179,7 @@ VMMousePlug(pointer module,
char *name;
xf86LoaderReqSymLists(reqSymbols, NULL);
-
+
if (!Initialised) {
Initialised = TRUE;
#ifndef REMOVE_LOADER_CHECK_MODULE_INFO
@@ -1145,7 +1206,7 @@ VMMousePlug(pointer module,
LoaderErrorMsg(NULL, name, *errmaj, *errmin);
}
xfree(name);
-
+
return module;
}
diff --git a/driver/xf86-input-vmmouse/src/vmmouse_client.c b/driver/xf86-input-vmmouse/src/vmmouse_client.c
index 5f27e5416..f34c223b9 100644
--- a/driver/xf86-input-vmmouse/src/vmmouse_client.c
+++ b/driver/xf86-input-vmmouse/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.
*/
diff --git a/driver/xf86-input-vmmouse/src/vmmouse_proto.h b/driver/xf86-input-vmmouse/src/vmmouse_proto.h
index 6a08e27e4..a2eb1e428 100644
--- a/driver/xf86-input-vmmouse/src/vmmouse_proto.h
+++ b/driver/xf86-input-vmmouse/src/vmmouse_proto.h
@@ -36,10 +36,20 @@
#ifndef _VMMOUSE_PROTO_H_
#define _VMMOUSE_PROTO_H_
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdint.h>
+
+#ifdef HAVE_XORG_SERVER_1_1_0
#include <unistd.h>
+#else
+#include "xf86_libc.h"
+#endif
-#if !defined __i386__ && !defined __x86_64__
+#if !defined __i386__ && !defined __x86_64__
#error The vmmouse protocol is only supported on x86 architectures.
#endif