Lines Matching defs:pMse

157 static void FlushButtons(MouseDevPtr pMse);
173 static Bool collectData(MouseDevPtr pMse, unsigned char u);
174 static void SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID);
175 static Bool autoGood(MouseDevPtr pMse);
305 MouseDevPtr pMse;
311 pMse = pInfo->private;
313 pMse->buttons = xf86SetIntOption(pInfo->options, "Buttons", 0);
314 if (!pMse->buttons) {
315 pMse->buttons = MSE_DFLTBUTTONS;
318 origButtons = pMse->buttons;
320 pMse->emulate3Buttons = xf86SetBoolOption(pInfo->options,
323 pMse->emulate3ButtonsSoft = TRUE;
324 pMse->emulate3Buttons = TRUE;
327 pMse->emulate3Timeout = xf86SetIntOption(pInfo->options,
329 if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
331 if (pMse->emulate3ButtonsSoft)
334 pInfo->name, pMse->emulate3Timeout);
337 pMse->chordMiddle = xf86SetBoolOption(pInfo->options, "ChordMiddle", FALSE);
338 pMse->flipXY = xf86SetBoolOption(pInfo->options, "FlipXY", FALSE);
340 pMse->invX = -1;
342 pMse->invX = 1;
344 pMse->invY = -1;
346 pMse->invY = 1;
347 pMse->angleOffset = xf86SetIntOption(pInfo->options, "AngleOffset", 0);
350 if (pMse->pDragLock)
351 free(pMse->pDragLock);
352 pMse->pDragLock = NULL;
364 pLock = pMse->pDragLock = calloc(1, sizeof(DragLockRec));
463 pMse->negativeZ = pMse->positiveZ = MSE_NOAXISMAP;
464 pMse->negativeW = pMse->positiveW = MSE_NOAXISMAP;
466 pMse->negativeZ = pMse->positiveZ = MSE_MAPTOX;
469 pMse->negativeZ = pMse->positiveZ = MSE_MAPTOY;
474 pMse->negativeZ = 1 << (b1-1);
475 pMse->positiveZ = 1 << (b2-1);
478 pMse->negativeW = 1 << (b3-1);
479 pMse->positiveW = 1 << (b4-1);
496 if (b1 > pMse->buttons) pMse->buttons = b1;
497 if (b2 > pMse->buttons) pMse->buttons = b2;
498 if (b3 > pMse->buttons) pMse->buttons = b3;
499 if (b4 > pMse->buttons) pMse->buttons = b4;
514 pMse->emulateWheel = TRUE;
522 pMse->wheelButton = wheelButton;
524 pMse->wheelInertia = xf86SetIntOption(pInfo->options,
526 if (pMse->wheelInertia <= 0) {
528 pInfo->name, pMse->wheelInertia);
529 pMse->wheelInertia = 10;
531 pMse->wheelButtonTimeout = xf86SetIntOption(pInfo->options,
533 if (pMse->wheelButtonTimeout <= 0) {
535 pInfo->name, pMse->wheelButtonTimeout);
536 pMse->wheelButtonTimeout = 200;
539 pMse->negativeX = MSE_NOAXISMAP;
540 pMse->positiveX = MSE_NOAXISMAP;
555 pMse->negativeX = b1;
556 pMse->positiveX = b2;
557 if (b1 > pMse->buttons) pMse->buttons = b1;
558 if (b2 > pMse->buttons) pMse->buttons = b2;
583 pMse->negativeY = b1;
584 pMse->positiveY = b2;
585 if (b1 > pMse->buttons) pMse->buttons = b1;
586 if (b2 > pMse->buttons) pMse->buttons = b2;
599 pMse->negativeY = 4;
600 pMse->positiveY = 5;
601 if (pMse->negativeY > pMse->buttons)
602 pMse->buttons = pMse->negativeY;
603 if (pMse->positiveY > pMse->buttons)
604 pMse->buttons = pMse->positiveY;
606 pInfo->name, pMse->negativeY, pMse->positiveY);
611 pInfo->name, wheelButton, pMse->wheelInertia,
612 pMse->wheelButtonTimeout);
626 pMse->buttonMap[n++] = 1 << (b-1);
627 if (b > pMse->buttons) pMse->buttons = b;
632 for (i = pMse->buttons-1; i >= 0; i--) {
633 int f = ffs (pMse->buttonMap[i]);
634 if (f > pMse->buttons)
635 pMse->buttons = f;
637 if (origButtons != pMse->buttons)
639 xf86Msg(buttons_from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
641 pMse->doubleClickSourceButtonMask = 0;
642 pMse->doubleClickTargetButtonMask = 0;
643 pMse->doubleClickTargetButton = 0;
658 pMse->doubleClickTargetButton = b1;
659 pMse->doubleClickTargetButtonMask = 1 << (b1 - 1);
660 pMse->doubleClickSourceButtonMask = 1 << (b2 - 1);
661 if (b1 > pMse->buttons) pMse->buttons = b1;
662 if (b2 > pMse->buttons) pMse->buttons = b2;
706 MouseDevPtr pMse = pInfo->private;
707 mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
716 pMse->sampleRate = xf86SetIntOption(pInfo->options, "SampleRate", 0);
717 pMse->resolution = xf86SetIntOption(pInfo->options, "Resolution", 0);
724 MouseDevPtr pMse = pInfo->private;
726 pMse->baudRate = xf86SetIntOption(pInfo->options, "BaudRate", 0);
952 MouseDevPtr pMse;
975 if (!(pMse = calloc(sizeof(MouseDevRec), 1)))
981 pInfo->private = pMse;
982 pMse->Ctrl = MouseCtrl;
983 pMse->PostEvent = MousePostEvent;
984 pMse->CommonOptions = MouseCommonOptions;
1004 pMse->buttonMap[i] = 1 << (i > 2 && i < MSE_MAXBUTTONS-4 ? i+4 : i);
1020 pMse->protocolID = protocolID;
1021 pMse->oldProtocolID = protocolID; /* hack */
1023 pMse->autoProbe = FALSE;
1043 if (pMse->mousePriv)
1044 free(pMse->mousePriv);
1045 free(pMse);
1060 pMse->mousePriv = mPriv;
1061 pMse->CommonOptions(pInfo);
1062 pMse->checkMovements = checkForErraticMovements;
1063 pMse->autoProbeMouse = autoProbeMouse;
1064 pMse->collectData = collectData;
1065 pMse->dataGood = autoGood;
1097 MouseDevPtr pMse = pInfo->private;
1113 pMse->emulate3Timeout = *((CARD32*)val->data);
1123 MouseDevPtr pMse = pInfo->private;
1141 if (pMse->buttons > 0)
1151 PropModeReplace, pMse->buttons,
1166 &pMse->emulate3Buttons, FALSE);
1175 &pMse->emulate3Timeout, FALSE);
1187 MouseDevPtr pMse;
1194 pMse = pInfo->private;
1195 pBufP = pMse->protoBufTail;
1196 pBuf = pMse->protoBuf;
1207 XisbBlockDuration(pMse->buffer, -1);
1209 while ((c = XisbRead(pMse->buffer)) >= 0) {
1217 if (pMse->collectData && pMse->autoProbe)
1218 if (pMse->collectData(pMse,u))
1227 if (pBufP >= pMse->protoPara[4]) {
1234 if ((u & pMse->protoPara[0]) != pMse->protoPara[1] &&
1235 (u & pMse->protoPara[5]) == pMse->protoPara[6]) {
1265 * have been detected (pBufP >= pMse->protoPara[4]). In the
1275 switch (pMse->protocolID) {
1294 | (pMse->lastButtons & 0x05);
1304 (pMse->lastButtons & 0x05);
1317 if (pBufP != pMse->protoPara[4]) continue;
1379 * Note: The driver starts in out-of-sync mode (pMse->inSync = 0).
1386 if ((pBuf[j] & pMse->protoPara[2]) != pMse->protoPara[3])
1390 if ((pMse->protoPara[7] & MPF_SAFE) && !pMse->inSync)
1392 if ((pBuf[j] & pMse->protoPara[0]) == pMse->protoPara[1])
1396 if ((pBuf[0] & pMse->protoPara[0]) != pMse->protoPara[1] || baddata) {
1397 if (pMse->inSync) {
1406 if (pMse->autoProbeMouse && pMse->autoProbe)
1407 pMse->autoProbeMouse(pInfo, FALSE, pMse->inSync);
1408 pMse->protoBufTail = --pBufP;
1411 pMse->inSync = 0;
1415 if (pMse->autoProbeMouse && pMse->autoProbe)
1416 pMse->autoProbeMouse(pInfo, TRUE, FALSE);
1418 if (!pMse->inSync) {
1422 pMse->inSync = 1;
1425 if (!pMse->dataGood(pMse))
1433 switch (pMse->protocolID) {
1436 if (pMse->chordMiddle)
1441 buttons = (pMse->lastButtons & 2)
1451 buttons = (pMse->lastButtons & (8 + 2))
1518 if (pMse->autoProbe) {
1519 SetMouseProto(pMse, PROT_EXPPS2);
1522 pMse->protocol);
1531 if (pMse->autoProbe && (pBuf[3] & 0xC0)) {
1532 SetMouseProto(pMse, PROT_IMPS2);
1534 pMse->protocol);
1544 if (pMse->negativeW != MSE_NOAXISMAP) {
1554 pMse->negativeW = pMse->positiveW = MSE_NOAXISMAP;
1557 if (pMse->negativeW == MSE_NOAXISMAP)
1583 buttons |= (pMse->lastButtons & ~0x07);
1592 buttons |= (pMse->lastButtons & ~0x07);
1598 buttons |= (pMse->lastButtons & ~0x07);
1639 if (pMse->protoPara[4] >= 8) {
1678 if (pMse->checkMovements && pMse->autoProbe)
1679 pMse->checkMovements(pInfo,dx,dy);
1681 pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
1688 pMse->protoBufTail = pBufP;
1715 MouseDevPtr pMse;
1723 pMse = pInfo->private;
1724 pMse->device = device;
1742 min(pMse->buttons, MSE_MAXBUTTONS),
1744 pMse->Ctrl,
1784 if (pMse->xisbscale)
1785 pMse->buffer = XisbNew(pInfo->fd, pMse->xisbscale * 4);
1787 pMse->buffer = XisbNew(pInfo->fd, 64);
1788 if (!pMse->buffer) {
1795 XisbFree(pMse->buffer);
1796 pMse->buffer = NULL;
1798 mPriv = (mousePrivPtr)pMse->mousePriv;
1800 if ( pMse->protocolID != PROT_AUTO) {
1801 pMse->inSync = TRUE; /* @@@ */
1815 if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft) {
1823 pMse->lastButtons = 0;
1824 pMse->lastMappedButtons = 0;
1825 pMse->emulateState = 0;
1826 pMse->emulate3Pending = FALSE;
1827 pMse->wheelButtonExpires = GetTimeInMillis ();
1829 FlushButtons(pMse);
1835 if (pMse->buffer) {
1836 XisbFree(pMse->buffer);
1837 pMse->buffer = NULL;
1841 if (pMse->emulate3Buttons || pMse->emulate3ButtonsSoft)
1851 free(pMse->mousePriv);
1852 pMse->mousePriv = NULL;
1868 FlushButtons(MouseDevPtr pMse)
1870 pMse->lastButtons = 0;
1871 pMse->lastMappedButtons = 0;
2043 MouseDevPtr pMse;
2049 pMse = pInfo->private;
2057 pMse->emulate3Pending = FALSE;
2058 if ((id = stateTab[pMse->emulateState][4][0]) != 0) {
2060 pMse->emulateState = stateTab[pMse->emulateState][4][2];
2063 "Got unexpected buttonTimer in state %d\n", pMse->emulateState);
2077 MouseDevPtr pMse = pInfo->private;
2079 if (pMse->emulate3Buttons == enable)
2082 pMse->emulate3Buttons = enable;
2085 pMse->emulateState = 0;
2086 pMse->emulate3Pending = FALSE;
2087 pMse->emulate3ButtonsSoft = FALSE; /* specifically requested now */
2092 if (pMse->emulate3Pending)
2103 MouseDevPtr pMse = pInfo->private;
2105 if (!pMse->emulate3ButtonsSoft)
2130 MouseDevPtr pMse = (MouseDevPtr) pInfo->private;
2133 if (pMse->emulate3Pending)
2135 ms = pMse->emulate3Expires - GetTimeInMillis ();
2145 MouseDevPtr pMse = (MouseDevPtr) pInfo->private;
2148 if (pMse->emulate3Pending)
2150 ms = pMse->emulate3Expires - GetTimeInMillis ();
2165 MouseDevPtr pMse;
2172 pMse = pInfo->private;
2174 change = buttons ^ pMse->lastMappedButtons;
2175 pMse->lastMappedButtons = buttons;
2178 if (pMse->doubleClickSourceButtonMask) {
2179 if (buttons & pMse->doubleClickSourceButtonMask) {
2180 if (!(pMse->doubleClickOldSourceState)) {
2184 if (!(buttons & pMse->doubleClickTargetButtonMask)) {
2186 xf86PostButtonEvent(pInfo->dev, 0, pMse->doubleClickTargetButton, 1, 0, 0);
2187 xf86PostButtonEvent(pInfo->dev, 0, pMse->doubleClickTargetButton, 0, 0, 0);
2188 xf86PostButtonEvent(pInfo->dev, 0, pMse->doubleClickTargetButton, 1, 0, 0);
2189 xf86PostButtonEvent(pInfo->dev, 0, pMse->doubleClickTargetButton, 0, 0, 0);
2192 pMse->doubleClickOldSourceState = 1;
2195 pMse->doubleClickOldSourceState = 0;
2200 buttons &= ~(pMse->doubleClickSourceButtonMask);
2201 change &= ~(pMse->doubleClickSourceButtonMask);
2204 if (pMse->emulateWheel) {
2206 if(pMse->wheelButton == 0)
2209 wheelButtonMask = 1 << (pMse->wheelButton - 1);
2214 pMse->wheelButtonExpires = GetTimeInMillis () + pMse->wheelButtonTimeout;
2215 ms = - pMse->wheelButtonTimeout;
2217 ms = pMse->wheelButtonExpires - GetTimeInMillis ();
2224 xf86PostButtonEvent(pInfo->dev, 0, pMse->wheelButton,
2226 xf86PostButtonEvent(pInfo->dev, 0, pMse->wheelButton,
2231 ms = pMse->wheelButtonExpires - GetTimeInMillis ();
2238 if (pMse->negativeY != MSE_NOAXISMAP) {
2239 pMse->wheelYDistance += dy;
2240 if (pMse->wheelYDistance < 0) {
2241 emuWheelDelta = -pMse->wheelInertia;
2242 emuWheelButton = pMse->negativeY;
2244 emuWheelDelta = pMse->wheelInertia;
2245 emuWheelButton = pMse->positiveY;
2248 while (abs(pMse->wheelYDistance) > pMse->wheelInertia) {
2249 pMse->wheelYDistance -= emuWheelDelta;
2251 pMse->wheelXDistance = 0;
2268 if (pMse->negativeX != MSE_NOAXISMAP) {
2269 pMse->wheelXDistance += dx;
2270 if (pMse->wheelXDistance < 0) {
2271 emuWheelDelta = -pMse->wheelInertia;
2272 emuWheelButton = pMse->negativeX;
2274 emuWheelDelta = pMse->wheelInertia;
2275 emuWheelButton = pMse->positiveX;
2278 while (abs(pMse->wheelXDistance) > pMse->wheelInertia) {
2279 pMse->wheelXDistance -= emuWheelDelta;
2281 pMse->wheelYDistance = 0;
2310 if (pMse->emulate3ButtonsSoft && pMse->emulate3Pending && (dx || dy))
2322 if (pMse->pDragLock) {
2328 pLock = pMse->pDragLock;
2383 if (pMse->emulate3Buttons
2394 if ((id = stateTab[pMse->emulateState][emulateButtons][0]) != 0)
2396 if ((id = stateTab[pMse->emulateState][emulateButtons][1]) != 0)
2399 pMse->emulateState =
2400 stateTab[pMse->emulateState][emulateButtons][2];
2402 if (stateTab[pMse->emulateState][4][0] != 0) {
2403 pMse->emulate3Expires =
2404 GetTimeInMillis() + pMse->emulate3Timeout;
2405 pMse->emulate3Pending = TRUE;
2407 pMse->emulate3Pending = FALSE;
2425 MouseDevPtr pMse;
2430 pMse = pInfo->private;
2431 mousepriv = (mousePrivPtr)pMse->mousePriv;
2433 if (pMse->protocolID == PROT_MMHIT)
2442 buttons |= pMse->buttonMap[i];
2448 switch (pMse->negativeZ) {
2465 buttons &= ~(pMse->negativeZ | pMse->positiveZ);
2467 zbutton = pMse->negativeZ;
2470 zbutton = pMse->positiveZ;
2476 switch (pMse->negativeW) {
2493 buttons &= ~(pMse->negativeW | pMse->positiveW);
2495 wbutton = pMse->negativeW;
2498 wbutton = pMse->positiveW;
2507 if (pMse->angleOffset != 0) {
2508 double rad = 3.141592653 * pMse->angleOffset / 180.0;
2514 dx = pMse->invX * dx;
2515 dy = pMse->invY * dy;
2516 if (pMse->flipXY) {
2544 pMse->lastButtons = truebuttons;
2594 MouseDevPtr pMse;
2599 pMse = pInfo->private;
2602 if (pMse->protocolID == PROT_AUTO) {
2611 pMse->autoProbe = TRUE;
2620 SetMouseProto(pMse, pMse->protocolID);
2625 for (size_t i = 0; i < sizeof(pMse->protoPara); i++)
2627 pMse->protoPara[i] = protoPara[i];
2638 if (pMse->oldProtocolID != pMse->protocolID) {
2639 if ((pMse->protocolID >= 0)
2640 && (pMse->protocolID < PROT_NUMPROTOS)
2641 && mouseProtocols[pMse->protocolID].defaults) {
2643 mouseProtocols[pMse->protocolID].defaults, -1, 0);
2651 if (pMse->baudRate)
2652 xf86ReplaceIntOption(pInfo->options, "BaudRate", pMse->baudRate);
2653 pMse->oldProtocolID = pMse->protocolID; /* hack */
2664 pMse->protoBufTail = 0;
2665 pMse->inSync = 0;
2732 MouseDevPtr pMse = pInfo->private;
2742 switch (pMse->protocolID) {
2748 speed = pMse->baudRate;
2791 if (pMse->sampleRate <= 0) c = 'O'; /* 100 */
2792 else if (pMse->sampleRate <= 15) c = 'J'; /* 10 */
2793 else if (pMse->sampleRate <= 27) c = 'K'; /* 20 */
2794 else if (pMse->sampleRate <= 42) c = 'L'; /* 35 */
2795 else if (pMse->sampleRate <= 60) c = 'R'; /* 50 */
2796 else if (pMse->sampleRate <= 85) c = 'M'; /* 67 */
2797 else if (pMse->sampleRate <= 125) c = 'Q'; /* 100 */
2803 speed = pMse->baudRate;
2828 * Binary Format. pMse->sampleRate controls the sensitivity
2848 if (pMse->sampleRate <= 40) c = 'g';
2849 else if (pMse->sampleRate <= 100) c = 'd';
2850 else if (pMse->sampleRate <= 200) c = 'e';
2851 else if (pMse->sampleRate <= 500) c = 'h';
2852 else if (pMse->sampleRate <= 1000) c = 'j';
2890 osInfo->SetBMRes(pInfo, pMse->protocol, pMse->sampleRate,
2891 pMse->resolution);
2950 osInfo->SetMiscRes(pInfo, pMse->protocol, pMse->sampleRate,
2951 pMse->resolution);
2959 if (pMse->class & (MSE_PS2 | MSE_XPS2)) {
2983 osInfo->SetPS2Res(pInfo, pMse->protocol, pMse->sampleRate,
2984 pMse->resolution);
2995 if (pMse->sampleRate > 0) {
2996 if (pMse->sampleRate >= 200)
2998 else if (pMse->sampleRate >= 100)
3000 else if (pMse->sampleRate >= 80)
3002 else if (pMse->sampleRate >= 60)
3004 else if (pMse->sampleRate >= 40)
3017 if (pMse->resolution > 0) {
3018 if (pMse->resolution >= 200)
3020 else if (pMse->resolution >= 100)
3022 else if (pMse->resolution >= 50)
3070 MouseDevPtr pMse = pInfo->private;
3071 mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv;
3150 MouseDevPtr pMse = (MouseDevPtr) pInfo->private;
3151 mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv;
3168 MouseDevPtr pMse = (MouseDevPtr) pInfo->private;
3169 mousePrivPtr mousepriv = (mousePrivPtr)pMse->mousePriv;
3237 MouseDevPtr pMse = pInfo->private;
3282 pMse->protocolID = protocolID;
3293 createProtoList(MouseDevPtr pMse, MouseProtocolID *protoList)
3298 mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
3516 MouseDevPtr pMse = pInfo->private;
3517 mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
3544 if ((pMse->protocolID = hardProtocolList[mPriv->protocolID++])
3548 } else if (GetProtocol(pMse->protocolID) && SetupMouse(pInfo)) {
3549 FlushButtons(pMse);
3552 ProtocolIDToName(pMse->protocolID)));
3565 ProtocolIDToName(pMse->protocolID));
3582 ProtocolIDToName(pMse->protocolID));
3591 pMse->protocolID = PROT_AUTO;
3595 if (pMse->protocolID != PROT_AUTO)
3615 createProtoList(pMse, protocolList);
3621 pMse->protocolID = PROT_AUTO;
3625 if (pMse->protocolID != PROT_AUTO)
3638 ProtocolIDToName(pMse->protocolID));
3654 ProtocolIDToName(pMse->protocolID));
3700 SetMouseProto(pMse,prot);
3701 FlushButtons(pMse);
3713 autoGood(MouseDevPtr pMse)
3715 mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
3717 if (!pMse->autoProbe)
3746 MouseDevPtr pMse = pInfo->private;
3747 mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;
3800 SetMouseProto(MouseDevPtr pMse, MouseProtocolID protocolID)
3802 pMse->protocolID = protocolID;
3803 pMse->protocol = ProtocolIDToName(pMse->protocolID);
3804 pMse->class = ProtocolIDToClass(pMse->protocolID);
3805 if ((pMse->protocolID >= 0) && (pMse->protocolID < PROT_NUMPROTOS))
3806 memcpy(pMse->protoPara, proto[pMse->protocolID],
3807 sizeof(pMse->protoPara));
3809 if (pMse->emulate3ButtonsSoft)
3810 pMse->emulate3Buttons = TRUE;
3817 collectData(MouseDevPtr pMse, unsigned char u)
3819 mousePrivPtr mPriv = (mousePrivPtr)pMse->mousePriv;