summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShelley Gong <shelleygong@vmware.com>2009-05-11 10:08:56 -0700
committerPhilip Langdale <philipl@fido2.homeip.net>2009-05-11 10:13:58 -0700
commitd61609868697825717d2f6a63b2a6177cb13873b (patch)
treefc0922560b0898a4b578af1247ab92045e2714c6
parentd5ae42ec3849672438823b08ad06a69289ae99c5 (diff)
1) Fix bug where motion notify events were being sent with every button event.xf86-input-vmmouse-12.6.4
2) Classify relative vs. absolute packets individually rather than from a global flag. 3) Compile with older distros. 4) Bump for 12.6.4 Release. Signed-off-by: Philip Langdale <philipl@fido2.homeip.net>
-rw-r--r--configure.ac2
-rw-r--r--shared/vmmouse_defs.h6
-rw-r--r--src/vmmouse.c53
-rw-r--r--tools/vmmouse_detect.c6
4 files changed, 50 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index 118ae84..ab39f6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
AC_PREREQ(2.57)
AC_INIT([xf86-input-vmmouse],
- 12.6.3,
+ 12.6.4,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
xf86-input-vmmouse)
diff --git a/shared/vmmouse_defs.h b/shared/vmmouse_defs.h
index 8dc769e..d256faf 100644
--- a/shared/vmmouse_defs.h
+++ b/shared/vmmouse_defs.h
@@ -57,6 +57,12 @@
#define VMMOUSE_ERROR 0xffff0000
/*
+ * VMMouse Input packet flags
+ */
+#define VMMOUSE_MOVE_RELATIVE 1
+#define VMMOUSE_MOVE_ABSOLUTE 0
+
+/*
* VMMouse Input button flags
*/
#define VMMOUSE_LEFT_BUTTON 0x20
diff --git a/src/vmmouse.c b/src/vmmouse.c
index a712bd5..deec8c8 100644
--- a/src/vmmouse.c
+++ b/src/vmmouse.c
@@ -95,7 +95,7 @@
*/
#define VMMOUSE_MAJOR_VERSION 12
#define VMMOUSE_MINOR_VERSION 6
-#define VMMOUSE_PATCHLEVEL 2
+#define VMMOUSE_PATCHLEVEL 4
#define VMMOUSE_DRIVER_VERSION \
(VMMOUSE_MAJOR_VERSION * 65536 + VMMOUSE_MINOR_VERSION * 256 + VMMOUSE_PATCHLEVEL)
#define VMMOUSE_DRIVER_VERSION_STRING \
@@ -138,9 +138,11 @@ static void MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
* Definitions
*****************************************************************************/
typedef struct {
- int screenNum;
- Bool vmmouseAvailable;
- Bool relative;
+ int screenNum;
+ Bool vmmouseAvailable;
+ VMMOUSE_INPUT_DATA vmmousePrevInput;
+ Bool isCurrRelative;
+ Bool absoluteRequested;
} VMMousePrivRec, *VMMousePrivPtr;
static const char *reqSymbols[] = {
@@ -311,7 +313,7 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
return NULL;
}
- mPriv->relative = TRUE;
+ mPriv->absoluteRequested = FALSE;
/*
* try to enable vmmouse here
@@ -479,6 +481,7 @@ VMMouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
VMMousePrivPtr mPriv;
int truebuttons;
int id, change;
+ Bool mouseMoved = FALSE;
pMse = pInfo->private;
mPriv = (VMMousePrivPtr)pMse->mousePriv;
@@ -492,7 +495,14 @@ VMMouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
buttons = reverseBits(reverseMap, buttons);
- if (dx || dy) {
+ if (mPriv->isCurrRelative) {
+ mouseMoved = dx || dy;
+ } else {
+ mouseMoved = (dx != mPriv->vmmousePrevInput.X) ||
+ (dy != mPriv->vmmousePrevInput.Y) ||
+ (mPriv->vmmousePrevInput.Flags & VMMOUSE_MOVE_RELATIVE);
+ }
+ if (mouseMoved) {
#ifdef CALL_CONVERSION_PROC
/*
@@ -501,7 +511,7 @@ VMMouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy)
*/
VMMouseConvertProc(pInfo, 0, 2, dx, dy, 0, 0, 0, 0, &dx, &dy);
#endif
- xf86PostMotionEvent(pInfo->dev, !mPriv->relative, 0, 2, dx, dy);
+ xf86PostMotionEvent(pInfo->dev, !mPriv->isCurrRelative, 0, 2, dx, dy);
}
if (truebuttons != pMse->lastButtons) {
@@ -549,7 +559,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
break;
case MSE_MAPTOX:
if (dz != 0) {
- if(mPriv->relative)
+ if(mPriv->isCurrRelative)
dx = dz;
else
dx += dz;
@@ -558,7 +568,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
break;
case MSE_MAPTOY:
if (dz != 0) {
- if(mPriv->relative)
+ if(mPriv->isCurrRelative)
dy = dz;
else
dy += dz;
@@ -593,7 +603,7 @@ VMMousePostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy, int dz, int dw
*/
if (zbutton) {
buttons &= ~zbutton;
- if(mPriv->relative)
+ if(mPriv->isCurrRelative)
VMMouseDoPostEvent(pInfo, buttons, 0, 0);
else
VMMouseDoPostEvent(pInfo, buttons, dx, dy);
@@ -621,7 +631,6 @@ static void
FlushButtons(MouseDevPtr pMse)
{
pMse->lastButtons = 0;
- pMse->lastMappedButtons = 0;
}
@@ -865,8 +874,8 @@ VMMouseDeviceControl(DeviceIntPtr device, int mode)
VMMousePrivPtr mPriv = (VMMousePrivPtr)pMse->mousePriv;
if( mPriv->vmmouseAvailable ) {
VMMouseClient_Disable();
- mPriv->vmmouseAvailable = FALSE;
- mPriv->relative = TRUE;
+ mPriv->vmmouseAvailable = FALSE;
+ mPriv->absoluteRequested = FALSE;
}
xf86RemoveEnabledDevice(pInfo);
@@ -916,9 +925,14 @@ VMMouseReadInput(InputInfoPtr pInfo)
pMse = pInfo->private;
mPriv = pMse->mousePriv;
- if (mPriv->relative) {
+ if (!mPriv->absoluteRequested) {
+ /*
+ * We can request for absolute mode, but it depends on
+ * host whether it will send us absolute or relative
+ * position.
+ */
VMMouseClient_RequestAbsolute();
- mPriv->relative = FALSE;
+ mPriv->absoluteRequested = TRUE;
xf86Msg(X_INFO, "VMWARE(0): vmmouse enable absolute mode\n");
}
@@ -973,12 +987,14 @@ VMMouseReadInput(InputInfoPtr pInfo)
static void
GetVMMouseMotionEvent(InputInfoPtr pInfo){
MouseDevPtr pMse;
+ VMMousePrivPtr mPriv;
int buttons, dx, dy, dz, dw;
VMMOUSE_INPUT_DATA vmmouseInput;
int ps2Buttons = 0;
int numPackets;
pMse = pInfo->private;
+ mPriv = (VMMousePrivPtr)pMse->mousePriv;
while((numPackets = VMMouseClient_GetInput(&vmmouseInput))){
if (numPackets == VMMOUSE_ERROR) {
VMMouseClient_Disable();
@@ -1003,8 +1019,13 @@ GetVMMouseMotionEvent(InputInfoPtr pInfo){
dy = vmmouseInput.Y;
dz = (char)vmmouseInput.Z;
dw = 0;
+ /*
+ * Get the per package relative or absolute information.
+ */
+ mPriv->isCurrRelative = vmmouseInput.Flags & VMMOUSE_MOVE_RELATIVE;
/* post an event */
pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
+ mPriv->vmmousePrevInput = vmmouseInput;
}
}
@@ -1106,7 +1127,7 @@ VMMouseConvertProc(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v
if (first != 0 || num != 2)
return FALSE;
- if(mPriv->relative) {
+ if(mPriv->isCurrRelative) {
*x = v0;
*y = v1;
} else {
diff --git a/tools/vmmouse_detect.c b/tools/vmmouse_detect.c
index 0dd4827..ac238b4 100644
--- a/tools/vmmouse_detect.c
+++ b/tools/vmmouse_detect.c
@@ -30,10 +30,16 @@
#include <signal.h>
#include "vmmouse_client.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
void
segvCB(int sig)
{
+#if defined HAVE_XORG_SERVER_1_1_0
exit(1);
+#endif
}