Module Name: xsrc
Committed By: mrg
Date: Sun Jul 24 00:42:43 UTC 2011
Modified Files:
xsrc/external/mit/xf86-input-mouse/dist/src: mouse.c mouse.h
Removed Files:
xsrc/external/mit/xf86-input-mouse/dist/src: xf86OSmouse.h
Log Message:
merge xf86-video-mouse 1.7.1
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
xsrc/external/mit/xf86-input-mouse/dist/src/mouse.c
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h
cvs rdiff -u -r1.1.1.2 -r0 \
xsrc/external/mit/xf86-input-mouse/dist/src/xf86OSmouse.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-input-mouse/dist/src/mouse.c
diff -u xsrc/external/mit/xf86-input-mouse/dist/src/mouse.c:1.12 xsrc/external/mit/xf86-input-mouse/dist/src/mouse.c:1.13
--- xsrc/external/mit/xf86-input-mouse/dist/src/mouse.c:1.12 Sat May 21 15:00:58 2011
+++ xsrc/external/mit/xf86-input-mouse/dist/src/mouse.c Sun Jul 24 00:42:42 2011
@@ -53,22 +53,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <X11/X.h>
-#include <X11/Xproto.h>
#include "xf86.h"
#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h"
#include "xf86Xinput.h"
#include "xf86_OSproc.h"
-#include "xf86OSmouse.h"
-
-#ifndef NEED_XF86_TYPES
-#define NEED_XF86_TYPES /* for xisb.h when !XFree86LOADER */
-#endif
#ifdef __NetBSD__
#include <time.h>
@@ -125,16 +118,13 @@
} DragLockRec, *DragLockPtr;
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
static InputInfoPtr MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags);
-#if 0
-static void MouseUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
+#else
+static int MousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
#endif
static int MouseProc(DeviceIntPtr device, int what);
-static Bool MouseConvert(LocalDevicePtr local, int first, int num, int v0,
- int v1, int v2, int v3, int v4, int v5, int *x,
- int *y);
-
static void MouseCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
static void MousePostEvent(InputInfoPtr pInfo, int buttons,
int dx, int dy, int dz, int dw);
@@ -167,9 +157,8 @@
"mouse",
NULL,
MousePreInit,
- /*MouseUnInit,*/NULL,
NULL,
- 0
+ NULL,
};
#define RETRY_COUNT 4
@@ -210,19 +199,6 @@
"VMin", "1",
NULL
};
-#if 0
-/* Logitech series 9 *//* same as msc: now mlDefaults */
-static const char *logiDefaults[] = {
- "BaudRate", "1200",
- "DataBits", "8",
- "StopBits", "2",
- "Parity", "None",
- "FlowControl", "None",
- "VTime", "0",
- "VMin", "1",
- NULL
-};
-#endif
/* Hitachi Tablet */
static const char *mmhitDefaults[] = {
"BaudRate", "1200",
@@ -282,6 +258,8 @@
/* Misc (usually OS-specific) */
{ "SysMouse", MSE_MISC, mlDefaults, PROT_SYSMOUSE },
+ { "WSMouse", MSE_MISC, NULL, PROT_WSMOUSE },
+ { "VUID", MSE_MISC, NULL, PROT_VUID },
/* end of list */
{ NULL, MSE_NONE, NULL, PROT_UNKNOWN }
@@ -324,26 +302,20 @@
}
pMse->chordMiddle = xf86SetBoolOption(pInfo->options, "ChordMiddle", FALSE);
- if (pMse->chordMiddle)
- xf86Msg(X_CONFIG, "%s: ChordMiddle\n", pInfo->name);
pMse->flipXY = xf86SetBoolOption(pInfo->options, "FlipXY", FALSE);
- if (pMse->flipXY)
- xf86Msg(X_CONFIG, "%s: FlipXY\n", pInfo->name);
if (xf86SetBoolOption(pInfo->options, "InvX", FALSE)) {
pMse->invX = -1;
- xf86Msg(X_CONFIG, "%s: InvX\n", pInfo->name);
} else
pMse->invX = 1;
if (xf86SetBoolOption(pInfo->options, "InvY", FALSE)) {
pMse->invY = -1;
- xf86Msg(X_CONFIG, "%s: InvY\n", pInfo->name);
} else
pMse->invY = 1;
pMse->angleOffset = xf86SetIntOption(pInfo->options, "AngleOffset", 0);
if (pMse->pDragLock)
- xfree(pMse->pDragLock);
+ free(pMse->pDragLock);
pMse->pDragLock = NULL;
s = xf86SetStrOption(pInfo->options, "DragLockButtons", NULL);
@@ -356,7 +328,7 @@
char *s1; /* parse input string */
DragLockPtr pLock;
- pLock = pMse->pDragLock = xcalloc(1, sizeof(DragLockRec));
+ pLock = pMse->pDragLock = calloc(1, sizeof(DragLockRec));
/* init code */
/* initial string to be taken apart */
@@ -447,7 +419,7 @@
}
}
}
- xfree(s);
+ free(s);
}
s = xf86SetStrOption(pInfo->options, "ZAxisMapping", "4 5");
@@ -474,7 +446,7 @@
if (b3 > 0 && b3 <= MSE_MAXBUTTONS &&
b4 > 0 && b4 <= MSE_MAXBUTTONS) {
if (msg)
- xfree(msg);
+ free(msg);
msg = xstrdup("buttons XX, YY, ZZ and WW");
if (msg)
sprintf(msg, "buttons %d, %d, %d and %d", b1, b2, b3, b4);
@@ -488,12 +460,12 @@
}
if (msg) {
xf86Msg(X_CONFIG, "%s: ZAxisMapping: %s\n", pInfo->name, msg);
- xfree(msg);
+ free(msg);
} else {
xf86Msg(X_WARNING, "%s: Invalid ZAxisMapping value: \"%s\"\n",
pInfo->name, s);
}
- xfree(s);
+ free(s);
}
if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
Bool yFromConfig = FALSE;
@@ -547,9 +519,9 @@
}
if (msg) {
xf86Msg(X_CONFIG, "%s: XAxisMapping: %s\n", pInfo->name, msg);
- xfree(msg);
+ free(msg);
}
- xfree(s);
+ free(s);
}
s = xf86SetStrOption(pInfo->options, "YAxisMapping", NULL);
if (s) {
@@ -573,9 +545,9 @@
}
if (msg) {
xf86Msg(X_CONFIG, "%s: YAxisMapping: %s\n", pInfo->name, msg);
- xfree(msg);
+ free(msg);
}
- xfree(s);
+ free(s);
}
if (!yFromConfig) {
pMse->negativeY = 4;
@@ -608,7 +580,7 @@
pMse->buttonMap[n++] = 1 << (b-1);
if (b > pMse->buttons) pMse->buttons = b;
}
- xfree(s);
+ free(s);
}
/* get maximum of mapped buttons */
for (i = pMse->buttons-1; i >= 0; i--) {
@@ -644,9 +616,9 @@
}
if (msg) {
xf86Msg(X_CONFIG, "%s: DoubleClickButtons: %s\n", pInfo->name, msg);
- xfree(msg);
+ free(msg);
}
- xfree(s);
+ free(s);
}
}
/*
@@ -692,55 +664,16 @@
xf86Msg(X_CONFIG, "Don't initialize mouse when auto-probing\n");
}
pMse->sampleRate = xf86SetIntOption(pInfo->options, "SampleRate", 0);
- if (pMse->sampleRate) {
- xf86Msg(X_CONFIG, "%s: SampleRate: %d\n", pInfo->name,
- pMse->sampleRate);
- }
pMse->resolution = xf86SetIntOption(pInfo->options, "Resolution", 0);
- if (pMse->resolution) {
- xf86Msg(X_CONFIG, "%s: Resolution: %d\n", pInfo->name,
- pMse->resolution);
- }
-
- if ((mPriv->sensitivity
- = xf86SetRealOption(pInfo->options, "Sensitivity", 1.0))) {
- xf86Msg(X_CONFIG, "%s: Sensitivity: %g\n", pInfo->name,
- mPriv->sensitivity);
- }
+ mPriv->sensitivity = xf86SetRealOption(pInfo->options, "Sensitivity", 1.0);
}
static void
MouseSerialOptions(InputInfoPtr pInfo)
{
MouseDevPtr pMse = pInfo->private;
- Bool clearDTR, clearRTS;
-
-
- pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0);
- if (pMse->baudRate) {
- xf86Msg(X_CONFIG, "%s: BaudRate: %d\n", pInfo->name,
- pMse->baudRate);
- }
- if ((clearDTR = xf86SetBoolOption(pInfo->options, "ClearDTR",FALSE)))
- pMse->mouseFlags |= MF_CLEAR_DTR;
-
-
- if ((clearRTS = xf86SetBoolOption(pInfo->options, "ClearRTS",FALSE)))
- pMse->mouseFlags |= MF_CLEAR_RTS;
-
- if (clearDTR || clearRTS) {
- xf86Msg(X_CONFIG, "%s: ", pInfo->name);
- if (clearDTR) {
- xf86ErrorF("ClearDTR");
- if (clearRTS)
- xf86ErrorF(", ");
- }
- if (clearRTS) {
- xf86ErrorF("ClearRTS");
- }
- xf86ErrorF("\n");
- }
+ pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0);
}
static MouseProtocolID
@@ -822,7 +755,7 @@
if (osInfo)
return TRUE;
- osInfo = xf86OSMouseInit(0);
+ osInfo = OSMouseInit(0);
if (!osInfo)
return FALSE;
if (!osInfo->SupportedInterfaces)
@@ -853,66 +786,157 @@
return TRUE;
}
+static const char*
+MouseFindDevice(InputInfoPtr pInfo, const char* protocol)
+{
+ const char *device;
+
+ if (!osInfo->FindDevice)
+ return NULL;
+
+ xf86Msg(X_WARNING, "%s: No Device specified, looking for one...\n", pInfo->name);
+ device = osInfo->FindDevice(pInfo, protocol, 0);
+ if (!device)
+ xf86Msg(X_ERROR, "%s: Cannot find which device to use.\n", pInfo->name);
+ else
+ xf86Msg(X_PROBED, "%s: Device: \"%s\"\n", pInfo->name, device);
+
+ return device;
+}
+
+static const char*
+MousePickProtocol(InputInfoPtr pInfo, const char* device,
+ const char *protocol, MouseProtocolID *protocolID_out)
+{
+ MouseProtocolID protocolID = *protocolID_out;
+
+ protocolID = ProtocolNameToID(protocol);
+
+ if (protocolID == PROT_AUTO)
+ {
+ const char *osProt;
+ if (osInfo->SetupAuto && (osProt = osInfo->SetupAuto(pInfo,NULL))) {
+ MouseProtocolID id = ProtocolNameToID(osProt);
+ if (id == PROT_UNKNOWN || id == PROT_UNSUP) {
+ protocolID = id;
+ protocol = osProt;
+ }
+ }
+ }
+
+ switch (protocolID) {
+ case PROT_WSMOUSE:
+ case PROT_VUID:
+ if (osInfo->PreInit)
+ osInfo->PreInit(pInfo, protocol, 0);
+ break;
+ case PROT_UNKNOWN:
+ /* Check for a builtin OS-specific protocol,
+ * and call its PreInit. */
+ if (osInfo->CheckProtocol
+ && osInfo->CheckProtocol(protocol)) {
+ if (!device)
+ MouseFindDevice(pInfo, protocol);
+ if (osInfo->PreInit) {
+ osInfo->PreInit(pInfo, protocol, 0);
+ }
+ break;
+ }
+ xf86Msg(X_ERROR, "%s: Unknown protocol \"%s\"\n",
+ pInfo->name, protocol);
+ break;
+ case PROT_UNSUP:
+ xf86Msg(X_ERROR,
+ "%s: Protocol \"%s\" is not supported on this "
+ "platform\n", pInfo->name, protocol);
+ break;
+ default:
+ break;
+ }
+
+ *protocolID_out = protocolID;
+
+ return protocol;
+}
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+static int NewMousePreInit(InputDriverPtr drv, InputInfoPtr pInfo,
+ int flags);
+
static InputInfoPtr
MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
InputInfoPtr pInfo;
+
+ if (!(pInfo = xf86AllocateInput(drv, 0)))
+ return NULL;
+
+ pInfo->name = dev->identifier;
+ pInfo->flags = XI86_SEND_DRAG_EVENTS;
+ pInfo->conf_idev = dev;
+ pInfo->close_proc = NULL;
+ pInfo->private_flags = 0;
+ pInfo->always_core_feedback = NULL;
+
+ if (NewMousePreInit(drv, pInfo, flags) == Success)
+ {
+ /* Check if SendDragEvents has been disabled. */
+ if (!xf86SetBoolOption(dev->commonOptions, "SendDragEvents", TRUE))
+ pInfo->flags &= ~XI86_SEND_DRAG_EVENTS;
+
+ pInfo->flags |= XI86_CONFIGURED;
+
+ return pInfo;
+ }
+
+ xf86DeleteInput(pInfo, 0);
+
+ return NULL;
+}
+
+static int
+NewMousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#else
+static int
+MousePreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#endif
+{
MouseDevPtr pMse;
mousePrivPtr mPriv;
- MessageType protocolFrom = X_DEFAULT, deviceFrom = X_CONFIG;
- const char *protocol, *osProt = NULL;
+ MessageType protocolFrom = X_DEFAULT;
+ const char *protocol;
const char *device;
MouseProtocolID protocolID;
MouseProtocolPtr pProto;
- Bool detected;
int i;
-
- if (!InitProtocols())
- return NULL;
+ int rc = Success;
- if (!(pInfo = xf86AllocateInput(drv, 0)))
- return NULL;
+ if (!InitProtocols())
+ return BadAlloc;
/* Initialise the InputInfoRec. */
- pInfo->name = dev->identifier;
pInfo->type_name = XI_MOUSE;
- pInfo->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS;
pInfo->device_control = MouseProc;
pInfo->read_input = MouseReadInput;
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- pInfo->motion_history_proc = xf86GetMotionEvents;
- pInfo->history_size = 0;
-#endif
pInfo->control_proc = NULL;
- pInfo->close_proc = NULL;
pInfo->switch_mode = NULL;
- pInfo->conversion_proc = MouseConvert;
- pInfo->reverse_conversion_proc = NULL;
pInfo->fd = -1;
pInfo->dev = NULL;
- pInfo->private_flags = 0;
- pInfo->always_core_feedback = NULL;
- pInfo->conf_idev = dev;
- /* Check if SendDragEvents has been disabled. */
- if (!xf86SetBoolOption(dev->commonOptions, "SendDragEvents", TRUE)) {
- pInfo->flags &= ~XI86_SEND_DRAG_EVENTS;
+ /* Allocate the MouseDevRec and initialise it. */
+ if (!(pMse = calloc(sizeof(MouseDevRec), 1)))
+ {
+ rc = BadAlloc;
+ goto out;
}
- /* Allocate the MouseDevRec and initialise it. */
- /*
- * XXX This should be done by a function in the core server since the
- * MouseDevRec is defined in the os-support layer.
- */
- if (!(pMse = xcalloc(sizeof(MouseDevRec), 1)))
- return pInfo;
pInfo->private = pMse;
pMse->Ctrl = MouseCtrl;
pMse->PostEvent = MousePostEvent;
pMse->CommonOptions = MouseCommonOptions;
-
+
/* Find the protocol type. */
- protocol = xf86SetStrOption(dev->commonOptions, "Protocol", NULL);
+ protocol = xf86SetStrOption(pInfo->options, "Protocol", NULL);
if (protocol) {
protocolFrom = X_CONFIG;
} else if (osInfo->DefaultProtocol) {
@@ -921,92 +945,44 @@
}
if (!protocol) {
xf86Msg(X_ERROR, "%s: No Protocol specified\n", pInfo->name);
- return pInfo;
+ rc = BadValue;
+ goto out;
}
+ device = xf86SetStrOption(pInfo->options, "Device", NULL);
+
/* Default Mapping: 1 2 3 8 9 10 11 ... */
for (i = 0; i < MSE_MAXBUTTONS; i++)
pMse->buttonMap[i] = 1 << (i > 2 && i < MSE_MAXBUTTONS-4 ? i+4 : i);
- protocolID = ProtocolNameToID(protocol);
- do {
- detected = TRUE;
- switch (protocolID) {
- case PROT_AUTO:
- if (osInfo->SetupAuto) {
- if ((osProt = osInfo->SetupAuto(pInfo,NULL))) {
- MouseProtocolID id = ProtocolNameToID(osProt);
- if (id == PROT_UNKNOWN || id == PROT_UNSUP) {
- protocolID = id;
- protocol = osProt;
- detected = FALSE;
- }
- }
- }
- break;
- case PROT_UNKNOWN:
- /* Check for a builtin OS-specific protocol,
- * and call its PreInit. */
- if (osInfo->CheckProtocol
- && osInfo->CheckProtocol(protocol)) {
- if (!xf86CheckStrOption(dev->commonOptions, "Device", NULL) &&
- osInfo->FindDevice) {
- xf86Msg(X_WARNING, "%s: No Device specified, "
- "looking for one...\n", pInfo->name);
- if (!osInfo->FindDevice(pInfo, protocol, 0)) {
- xf86Msg(X_ERROR, "%s: Cannot find which device "
- "to use.\n", pInfo->name);
- } else
- deviceFrom = X_PROBED;
- }
- if (osInfo->PreInit) {
- osInfo->PreInit(pInfo, protocol, 0);
- }
- return pInfo;
- }
- xf86Msg(X_ERROR, "%s: Unknown protocol \"%s\"\n",
- pInfo->name, protocol);
- return pInfo;
- break;
- case PROT_UNSUP:
- xf86Msg(X_ERROR,
- "%s: Protocol \"%s\" is not supported on this "
- "platform\n", pInfo->name, protocol);
- return pInfo;
- break;
- default:
- break;
-
- }
- } while (!detected);
-
- if (!xf86CheckStrOption(dev->commonOptions, "Device", NULL) &&
- osInfo->FindDevice) {
- xf86Msg(X_WARNING, "%s: No Device specified, looking for one...\n",
- pInfo->name);
- if (!osInfo->FindDevice(pInfo, protocol, 0)) {
- xf86Msg(X_ERROR, "%s: Cannot find which device to use.\n",
- pInfo->name);
- } else {
- deviceFrom = X_PROBED;
- xf86MarkOptionUsedByName(dev->commonOptions, "Device");
- }
- }
+ protocol = MousePickProtocol(pInfo, device, protocol, &protocolID);
+
+ if (!device)
+ MouseFindDevice(pInfo, protocol);
- device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
- if (device)
- xf86Msg(deviceFrom, "%s: Device: \"%s\"\n", pInfo->name, device);
-
xf86Msg(protocolFrom, "%s: Protocol: \"%s\"\n", pInfo->name, protocol);
+ if (protocolID == PROT_UNKNOWN)
+ goto out;
if (!(pProto = GetProtocol(protocolID)))
- return pInfo;
+ {
+ rc = BadValue;
+ goto out;
+ }
pMse->protocolID = protocolID;
pMse->oldProtocolID = protocolID; /* hack */
pMse->autoProbe = FALSE;
/* Collect the options, and process the common options. */
- xf86CollectInputOptions(pInfo, pProto->defaults, NULL);
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+ /* need some special handling here. xf86CollectInputOptions will reset
+ * pInfo->options if the second argument is not-null. To re-merge the
+ * previously set arguments, pass the original pInfo->options in.
+ */
+ xf86CollectInputOptions(pInfo, pProto->defaults, pInfo->options);
+#else
+ COLLECT_INPUT_OPTIONS(pInfo, pProto->defaults);
+#endif
xf86ProcessCommonOptions(pInfo, pInfo->options);
/* Check if the device can be opened. */
@@ -1017,17 +993,22 @@
else {
xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
if (pMse->mousePriv)
- xfree(pMse->mousePriv);
- xfree(pMse);
+ free(pMse->mousePriv);
+ free(pMse);
pInfo->private = NULL;
- return pInfo;
+ rc = BadValue;
+ goto out;
}
}
xf86CloseSerial(pInfo->fd);
pInfo->fd = -1;
- if (!(mPriv = (pointer) xcalloc(sizeof(mousePrivRec), 1)))
- return pInfo;
+ if (!(mPriv = (pointer) calloc(sizeof(mousePrivRec), 1)))
+ {
+ rc = BadAlloc;
+ goto out;
+ }
+
pMse->mousePriv = mPriv;
pMse->CommonOptions(pInfo);
pMse->checkMovements = checkForErraticMovements;
@@ -1037,9 +1018,9 @@
MouseHWOptions(pInfo);
MouseSerialOptions(pInfo);
-
- pInfo->flags |= XI86_CONFIGURED;
- return pInfo;
+
+out:
+ return rc;
}
@@ -1605,17 +1586,8 @@
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
btn_labels,
#endif
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- miPointerGetMotionEvents,
-#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
- GetMotionHistory,
-#endif
pMse->Ctrl,
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- miPointerGetMotionBufferSize()
-#else
GetMotionHistorySize(), 2
-#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
, axes_labels
#endif
@@ -1626,18 +1598,23 @@
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels[0],
#endif
- -1, -1, 1, 0, 1);
+ -1, -1, 1, 0, 1
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
+ , Relative
+#endif
+ );
xf86InitValuatorDefaults(device, 0);
/* Y valuator */
xf86InitValuatorAxisStruct(device, 1,
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels[1],
#endif
- -1, -1, 1, 0, 1);
- xf86InitValuatorDefaults(device, 1);
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
- xf86MotionHistoryAllocate(pInfo);
+ -1, -1, 1, 0, 1
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
+ , Relative
#endif
+ );
+ xf86InitValuatorDefaults(device, 1);
#ifdef EXTMOUSEDEBUG
ErrorF("assigning %p atom=%d name=%s\n", device, pInfo->atom,
@@ -1722,34 +1699,13 @@
device->public.on = FALSE;
break;
case DEVICE_CLOSE:
- xfree(pMse->mousePriv);
+ free(pMse->mousePriv);
pMse->mousePriv = NULL;
break;
}
return Success;
}
-/*
- ***************************************************************************
- *
- * MouseConvert --
- * Convert valuators to X and Y.
- *
- ***************************************************************************
- */
-static Bool
-MouseConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2,
- int v3, int v4, int v5, int *x, int *y)
-{
- if (first != 0 || num != 2)
- return FALSE;
-
- *x = v0;
- *y = v1;
-
- return TRUE;
-}
-
/**********************************************************************
*
* FlushButtons -- reset button states.
@@ -2409,7 +2365,7 @@
******************************************************************/
/*
* This array is indexed by the MouseProtocolID values, so the order of the
- * entries must match that of the MouseProtocolID enum in xf86OSmouse.h.
+ * entries must match that of the MouseProtocolID enum in mouse.h.
*/
static unsigned char proto[PROT_NUMPROTOS][8] = {
/* --header-- ---data--- packet -4th-byte- mouse */
@@ -2487,13 +2443,7 @@
pMse->protoPara[i] = protoPara[i];
/* if we come here PnP/OS mouse probing was successful */
} else {
-#if 1
/* PnP/OS mouse probing wasn't successful; we look at data */
-#else
- xf86Msg(X_ERROR, "%s: cannot determine the mouse protocol\n",
- pInfo->name);
- return FALSE;
-#endif
}
}
@@ -2649,7 +2599,7 @@
usleep(100000);
/* Set the parameters up for the MM series protocol. */
options = pInfo->options;
- xf86CollectInputOptions(pInfo, mmDefaults, NULL);
+ COLLECT_INPUT_OPTIONS(pInfo, mmDefaults);
xf86SetSerial(pInfo->fd, pInfo->options);
pInfo->options = options;
@@ -3173,7 +3123,7 @@
blocked = xf86BlockSIGIO ();
/* create a private copy first so we can write in the old list */
- if ((tmplist = xalloc(sizeof(MouseProtocolID) * NUM_AUTOPROBE_PROTOS))){
+ if ((tmplist = malloc(sizeof(MouseProtocolID) * NUM_AUTOPROBE_PROTOS))){
for (i = 0; protoList[i] != PROT_UNKNOWN; i++) {
tmplist[i] = protoList[i];
}
@@ -3283,7 +3233,7 @@
mPriv->protoList[k] = PROT_UNKNOWN;
- xfree(tmplist);
+ free(tmplist);
}
Index: xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h
diff -u xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h:1.4 xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h:1.5
--- xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h:1.4 Sat May 22 09:49:13 2010
+++ xsrc/external/mit/xf86-input-mouse/dist/src/mouse.h Sun Jul 24 00:42:42 2011
@@ -1,10 +1,264 @@
/*
- * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
-#ifndef MOUSE_H_
-#define MOUSE_H_
+/* Public interface to OS-specific mouse support. */
-#include "xf86OSmouse.h"
+#ifndef _XF86OSMOUSE_H_
+#define _XF86OSMOUSE_H_
+#include "xf86Xinput.h"
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+#define COLLECT_INPUT_OPTIONS(pInfo, options) xf86CollectInputOptions((pInfo), (options), NULL)
+#else
+#define COLLECT_INPUT_OPTIONS(pInfo, options) xf86CollectInputOptions((pInfo), (options))
#endif
+
+
+/* Mouse interface classes */
+#define MSE_NONE 0x00
+#define MSE_SERIAL 0x01 /* serial port */
+#define MSE_BUS 0x02 /* old bus mouse */
+#define MSE_PS2 0x04 /* standard read-only PS/2 */
+#define MSE_XPS2 0x08 /* extended PS/2 */
+#define MSE_AUTO 0x10 /* auto-detect (PnP) */
+#define MSE_MISC 0x20 /* The OS layer will identify the
+ * specific protocol names that are
+ * supported for this class. */
+
+/* Mouse Protocol IDs. */
+typedef enum {
+ PROT_UNKNOWN = -2,
+ PROT_UNSUP = -1, /* protocol is not supported */
+ PROT_MS = 0,
+ PROT_MSC,
+ PROT_MM,
+ PROT_LOGI,
+ PROT_LOGIMAN,
+ PROT_MMHIT,
+ PROT_GLIDE,
+ PROT_IMSERIAL,
+ PROT_THINKING,
+ PROT_ACECAD,
+ PROT_VALUMOUSESCROLL,
+ PROT_PS2,
+ PROT_GENPS2,
+ PROT_IMPS2,
+ PROT_EXPPS2,
+ PROT_THINKPS2,
+ PROT_MMPS2,
+ PROT_GLIDEPS2,
+ PROT_NETPS2,
+ PROT_NETSCPS2,
+ PROT_BM,
+ PROT_AUTO,
+ PROT_SYSMOUSE,
+ PROT_WSMOUSE,
+ PROT_VUID,
+ PROT_NUMPROTOS /* This must always be last. */
+} MouseProtocolID;
+
+struct _MouseDevRec;
+
+typedef int (*GetInterfaceTypesProc)(void);
+typedef const char **(*BuiltinNamesProc)(void);
+typedef Bool (*CheckProtocolProc)(const char *protocol);
+typedef Bool (*BuiltinPreInitProc)(InputInfoPtr pInfo, const char *protocol,
+ int flags);
+typedef const char *(*DefaultProtocolProc)(void);
+typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara);
+typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate,
+ int res);
+typedef const char *(*FindDeviceProc)(InputInfoPtr pInfo, const char *protocol,
+ int flags);
+typedef const char *(*GuessProtocolProc)(InputInfoPtr pInfo, int flags);
+
+/*
+ * OSMouseInfoRec is used to pass information from the OSMouse layer to the
+ * OS-independent mouse driver.
+ */
+typedef struct {
+ GetInterfaceTypesProc SupportedInterfaces;
+ BuiltinNamesProc BuiltinNames;
+ CheckProtocolProc CheckProtocol;
+ BuiltinPreInitProc PreInit;
+ DefaultProtocolProc DefaultProtocol;
+ SetupAutoProc SetupAuto;
+ SetResProc SetPS2Res;
+ SetResProc SetBMRes;
+ SetResProc SetMiscRes;
+ FindDeviceProc FindDevice;
+ GuessProtocolProc GuessProtocol;
+} OSMouseInfoRec, *OSMouseInfoPtr;
+
+/*
+ * SupportedInterfaces: Returns the mouse interface types that the OS support.
+ * If MSE_MISC is returned, then the BuiltinNames and
+ * CheckProtocol should be set.
+ *
+ * BuiltinNames: Returns the names of the protocols that are fully handled
+ * in the OS-specific code. These are names that don't appear
+ * directly in the main "mouse" driver.
+ *
+ * CheckProtocol: Checks if the protocol name given is supported by the
+ * OS. It should return TRUE for both "builtin" protocols and
+ * protocols of type MSE_MISC that are supported by the OS.
+ *
+ * PreInit: The PreInit function for protocols that are builtin. This
+ * function is passed the protocol name.
+ *
+ * DefaultProtocol: Returns the name of a default protocol that should be used
+ * for the OS when none has been supplied in the config file.
+ * This should only be set when there is a reasonable default.
+ *
+ * SetupAuto: This function can be used to do OS-specific protocol
+ * auto-detection. It returns the name of the detected protocol,
+ * or NULL when detection fails. It may also adjust one or more
+ * of the "protoPara" values for the detected protocol by setting
+ * then to something other than -1. SetupAuto gets called in two
+ * ways. The first is before any devices have been opened. This
+ * can be used when the protocol "Auto" always maps to a single
+ * protocol type. The second is with the device open, allowing
+ * OS-specific probing to be done.
+ *
+ * SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2
+ * protocol types.
+ *
+ * SetBMRes: Set the resolution and sample rate for MSE_BM protocol types.
+ *
+ * SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types.
+ *
+ * FindDevice: This function gets called when no Device has been specified
+ * in the config file. OS-specific methods may be used to guess
+ * which input device to use. This function is called after the
+ * pre-open attempts at protocol discovery are done, but before
+ * the device is open. I.e., after the first SetupAuto() call,
+ * after the DefaultProtocol() call, but before the PreInit()
+ * call. Available protocol information may be used in locating
+ * the default input device.
+ *
+ * GuessProtocol: A last resort attempt at guessing the mouse protocol by
+ * whatever OS-specific means might be available. OS-independent
+ * things should be in the mouse driver. This function gets
+ * called after the mouse driver's OS-independent methods have
+ * failed.
+ */
+
+extern OSMouseInfoPtr OSMouseInit(int flags);
+
+/* Z axis mapping */
+#define MSE_NOZMAP 0
+#define MSE_MAPTOX -1
+#define MSE_MAPTOY -2
+#define MSE_MAPTOZ -3
+#define MSE_MAPTOW -4
+
+/* Generalize for other axes. */
+#define MSE_NOAXISMAP MSE_NOZMAP
+
+#define MSE_MAXBUTTONS 24
+#define MSE_DFLTBUTTONS 3
+
+/*
+ * Mouse device record. This is shared by the mouse driver and the OSMouse
+ * layer.
+ */
+
+typedef void (*checkMovementsProc)(InputInfoPtr,int, int);
+typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
+typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
+typedef Bool (*dataGoodProc)(struct _MouseDevRec *);
+
+typedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons,
+ int dx, int dy, int dz, int dw);
+typedef void (*MouseCommonOptProc)(InputInfoPtr pInfo);
+
+typedef struct _MouseDevRec {
+ PtrCtrlProcPtr Ctrl;
+ PostMseEventProc PostEvent;
+ MouseCommonOptProc CommonOptions;
+ DeviceIntPtr device;
+ const char * protocol;
+ MouseProtocolID protocolID;
+ MouseProtocolID oldProtocolID; /* hack */
+ int class;
+ int mseModel;
+ int baudRate;
+ int oldBaudRate;
+ int sampleRate;
+ int lastButtons;
+ int buttons; /* # of buttons */
+ int emulateState; /* automata state for 2 button mode */
+ Bool emulate3Buttons;
+ Bool emulate3ButtonsSoft;
+ int emulate3Timeout;/* Timeout for 3 button emulation */
+ Bool chordMiddle;
+ Bool flipXY;
+ int invX;
+ int invY;
+ int resolution;
+ int negativeZ; /* button mask */
+ int positiveZ; /* button mask */
+ int negativeW; /* button mask */
+ int positiveW; /* button mask */
+ pointer buffer; /* usually an XISBuffer* */
+ int protoBufTail;
+ unsigned char protoBuf[8];
+ unsigned char protoPara[8];
+ unsigned char inSync; /* driver in sync with datastream */
+ pointer mousePriv; /* private area */
+ InputInfoPtr pInfo;
+ Bool emulate3Pending;/* timer waiting */
+ CARD32 emulate3Expires;/* time to fire emulation code */
+ Bool emulateWheel;
+ int wheelInertia;
+ int wheelButton;
+ int negativeX; /* Button values. Unlike the Z and */
+ int positiveX; /* W equivalents, these are button */
+ int negativeY; /* values rather than button masks. */
+ int positiveY;
+ int wheelYDistance;
+ int wheelXDistance;
+ Bool autoProbe;
+ checkMovementsProc checkMovements;
+ autoProbeProc autoProbeMouse;
+ collectDataProc collectData;
+ dataGoodProc dataGood;
+ int angleOffset;
+ pointer pDragLock; /* drag lock area */
+ int xisbscale; /* buffer size for 1 event */
+ int wheelButtonTimeout;/* Timeout for the wheel button emulation */
+ CARD32 wheelButtonExpires;
+ int doubleClickSourceButtonMask;
+ int doubleClickTargetButton;
+ int doubleClickTargetButtonMask;
+ int doubleClickOldSourceState;
+ int lastMappedButtons;
+ int buttonMap[MSE_MAXBUTTONS];
+} MouseDevRec, *MouseDevPtr;
+
+#endif /* _XF86OSMOUSE_H_ */