Lines Matching refs:pi

100     KdPointerInfo *pi;
102 for (pi = kdPointers; pi; pi = pi->next) {
103 pi->mouseState = start;
104 pi->eventHeld = FALSE;
112 KdPointerInfo *pi;
121 for (pi = kdPointers; pi; pi = pi->next) {
122 if (pi->driver && pi->driver->Disable)
123 (*pi->driver->Disable) (pi);
134 KdPointerInfo *pi;
147 for (pi = kdPointers; pi; pi = pi->next) {
148 if (pi->driver && pi->driver->Enable)
149 (*pi->driver->Enable) (pi);
151 NoticeEventTime (&ev, pi->dixdev);
195 KdPointerInfo *pi;
203 for (pi = kdPointers; pi; pi = pi->next) {
204 if (pi->dixdev && pi->dixdev->id == pDevice->id)
208 if (!pi || !pi->dixdev || pi->dixdev->id != pDevice->id) {
217 ErrorF("initialising pointer %s ...\n", pi->name);
219 if (!pi->driver) {
220 if (!pi->driverPrivate) {
222 pi->name ? pi->name : "(unnamed)", pi->path);
226 pi->driver = KdFindPointerDriver(pi->driverPrivate);
227 if (!pi->driver) {
229 pi->driverPrivate ? (char *) pi->driverPrivate :
233 free(pi->driverPrivate);
234 pi->driverPrivate = NULL;
237 if (!pi->driver->Init) {
242 if ((*pi->driver->Init) (pi) != Success) {
246 btn_labels = calloc(pi->nButtons, sizeof(Atom));
249 axes_labels = calloc(pi->nAxes, sizeof(Atom));
255 switch (pi->nAxes) {
275 if (pi->nAxes >= 2) {
280 InitPointerDeviceStruct(pDev, pi->map, pi->nButtons, btn_labels,
282 GetMotionHistorySize(), pi->nAxes, axes_labels);
287 if (pi->inputClass == KD_TOUCHSCREEN) {
294 AssignTypeAndName(pi->dixdev, xiclass,
295 pi->name ? pi->name : "Generic KDrive Pointer");
303 if (!pi->driver->Enable) {
308 if ((*pi->driver->Enable) (pi) == Success) {
323 if (!pi->driver->Disable) {
327 (*pi->driver->Disable) (pi);
336 if (!pi->driver->Disable) {
339 (*pi->driver->Disable) (pi);
343 if (!pi->driver->Fini)
346 (*pi->driver->Fini) (pi);
348 KdRemovePointer(pi);
789 KdAddPointer(KdPointerInfo * pi)
793 if (!pi)
796 pi->mouseState = start;
797 pi->eventHeld = FALSE;
799 pi->dixdev = AddInputDevice(serverClient, KdPointerProc, TRUE);
800 if (!pi->dixdev) {
802 pi->name ? pi->name : "(unnamed)");
807 *prev = pi;
813 KdRemovePointer(KdPointerInfo * pi)
817 if (!pi)
821 if (*prev == pi) {
822 *prev = pi->next;
827 KdFreePointer(pi);
997 KdParsePointerOptions(KdPointerInfo * pi)
1001 nt_list_for_each_entry(option, pi->options, list.next) {
1006 pi->emulateMiddleButton = TRUE;
1008 pi->emulateMiddleButton = FALSE;
1010 pi->transformCoordinates = TRUE;
1012 pi->transformCoordinates = FALSE;
1014 if (pi->path != NULL)
1015 free(pi->path);
1016 pi->path = strdup(value);
1020 if (pi->path != NULL)
1021 free(pi->path);
1022 pi->path = strdup(value);
1025 free(pi->name);
1026 pi->name = strdup(value);
1030 pi->protocol = strdup(value);
1032 pi->driver = KdFindPointerDriver(value);
1044 KdPointerInfo *pi = NULL;
1048 pi = KdNewPointer();
1049 if (!pi)
1051 pi->emulateMiddleButton = kdEmulateMiddleButton;
1052 pi->transformCoordinates = !kdRawPointerCoordinates;
1053 pi->protocol = NULL;
1054 pi->nButtons = 5; /* XXX should not be hardcoded */
1055 pi->inputClass = KD_MOUSE;
1059 KdFreePointer(pi);
1065 KdFreePointer(pi);
1071 KdFreePointer(pi);
1076 pi->driverPrivate = NULL;
1078 pi->driverPrivate = strdup(save);
1081 return pi;
1093 if ('1' <= *s && *s <= '0' + pi->nButtons)
1094 pi->map[i] = *s - '0';
1102 KdFreePointer(pi);
1109 pi->options = options;
1110 KdParsePointerOptions(pi);
1113 return pi;
1119 KdPointerInfo *pi;
1129 pi = KdParsePointer(dev->line);
1130 if (!pi)
1132 if (KdAddPointer(pi) != Success)
1467 KdInsideEmulationWindow(KdPointerInfo * pi, int x, int y, int z)
1469 pi->emulationDx = pi->heldEvent.x - x;
1470 pi->emulationDy = pi->heldEvent.y - y;
1472 return (abs(pi->emulationDx) < EMULATION_WINDOW &&
1473 abs(pi->emulationDy) < EMULATION_WINDOW);
1477 KdClassifyInput(KdPointerInfo * pi, int type, int x, int y, int z, int b)
1505 if (pi->eventHeld && !KdInsideEmulationWindow(pi, x, y, z))
1516 _KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z,
1520 KdRunMouseMachine(KdPointerInfo * pi, KdInputClass c, int type, int x, int y,
1526 c = KdClassifyInput(pi, type, x, y, z, b);
1527 t = &kdInputMachine[pi->mouseState][c];
1533 pi->eventHeld = TRUE;
1534 pi->emulationDx = 0;
1535 pi->emulationDy = 0;
1536 pi->heldEvent.type = type;
1537 pi->heldEvent.x = x;
1538 pi->heldEvent.y = y;
1539 pi->heldEvent.z = z;
1540 pi->heldEvent.flags = b;
1541 pi->heldEvent.absrel = absrel;
1545 pi->emulationTimeout = GetTimeInMillis() + EMULATION_TIMEOUT;
1546 pi->timeoutPending = TRUE;
1549 _KdEnqueuePointerEvent(pi, pi->heldEvent.type, pi->heldEvent.x,
1550 pi->heldEvent.y, pi->heldEvent.z,
1551 pi->heldEvent.flags, pi->heldEvent.absrel,
1555 pi->eventHeld = FALSE;
1556 pi->timeoutPending = FALSE;
1557 _KdEnqueuePointerEvent(pi, pi->heldEvent.type, pi->heldEvent.x,
1558 pi->heldEvent.y, pi->heldEvent.z,
1559 pi->heldEvent.flags, pi->heldEvent.absrel,
1564 pi->timeoutPending = FALSE;
1567 _KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, 2, absrel, TRUE);
1568 pi->eventHeld = FALSE;
1572 _KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, 2, absrel, TRUE);
1577 pi->mouseState = t->nextState;
1582 KdHandlePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, int b,
1585 if (pi->emulateMiddleButton)
1586 return KdRunMouseMachine(pi, KdClassifyInput(pi, type, x, y, z, b),
1592 _KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z,
1599 if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
1604 QueuePointerEvents(pi->dixdev, type, b, absrel, &mask);
1608 KdReceiveTimeout(KdPointerInfo * pi)
1610 KdRunMouseMachine(pi, timeout, 0, 0, 0, 0, 0, 0);
1675 KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry,
1685 if (!pi)
1690 if (pi->transformCoordinates) {
1700 if (pi->transformCoordinates) {
1714 _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags,
1722 if (x != pi->dixdev->last.valuators[0] ||
1723 y != pi->dixdev->last.valuators[1])
1724 _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags,
1730 for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons; button <<= 1, n++) {
1731 if (((pi->buttonState & button) ^ (buttons & button)) &&
1733 _KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, n,
1737 for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons; button <<= 1, n++) {
1738 if (((pi->buttonState & button) ^ (buttons & button)) &&
1740 _KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, n,
1745 pi->buttonState = buttons;
1751 KdPointerInfo *pi;
1754 for (pi = kdPointers; pi; pi = pi->next) {
1755 if (pi->timeoutPending) {
1758 ms = pi->emulationTimeout - GetTimeInMillis();
1772 KdPointerInfo *pi;
1774 for (pi = kdPointers; pi; pi = pi->next) {
1775 if (pi->timeoutPending) {
1776 if ((long) (GetTimeInMillis() - pi->emulationTimeout) >= 0) {
1777 pi->timeoutPending = FALSE;
1779 KdReceiveTimeout(pi);
1934 KdPointerInfo *pi = NULL;
1944 pi = KdNewPointer();
1945 if (!pi) {
1968 pi = KdNewPointer();
1969 if (!pi) {
1995 pi = KdNewPointer();
1996 if (!pi) {
2018 if (pi) {
2019 pi->options = optionsdup;
2020 KdParsePointerOptions(pi);
2022 if (!pi->driver) {
2024 pi->name ? pi->name : "(unnamed)", pi->path);
2025 KdFreePointer(pi);
2029 if (KdAddPointer(pi) != Success ||
2030 ActivateDevice(pi->dixdev, TRUE) != Success ||
2031 EnableDevice(pi->dixdev, TRUE) != TRUE) {
2033 pi->name ? pi->name : "(unnamed)", pi->path);
2034 KdFreePointer(pi);
2038 *pdev = pi->dixdev;