diff options
author | Matthieu Herrb <matthieu@openbsd.org> | 2009-12-10 22:32:02 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@openbsd.org> | 2009-12-10 22:32:02 +0000 |
commit | 89f29ea1bc6b5ee0f58dd890d68f47a60c0dee38 (patch) | |
tree | 7c40f2c1493c6582931d0abceca0e7483af42fea /src/ws.c | |
parent | e1b340d67cc1a26464bbc683fcef696857651fe8 (diff) |
Fix SwapXY and rotation support.
More work to do wrt properties and calibration.
Diffstat (limited to 'src/ws.c')
-rw-r--r-- | src/ws.c | 42 |
1 files changed, 33 insertions, 9 deletions
@@ -418,6 +418,15 @@ wsDeviceInit(DeviceIntPtr pWS) ymax = -1; } + if (priv->swap_axes) { + int tmp; + tmp = xmin; + xmin = ymin; + ymin = tmp; + tmp = xmax; + xmax = ymax; + ymax = tmp; + } #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 if ((priv->type == WSMOUSE_TYPE_TPANEL)) { axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); @@ -455,6 +464,7 @@ wsDeviceInit(DeviceIntPtr pWS) #endif ymin, ymax, 1, 0, 1); xf86InitValuatorDefaults(pWS, 1); + xf86MotionHistoryAllocate(pInfo); AssignTypeAndName(pWS, pInfo->atom, pInfo->name); pWS->public.on = FALSE; @@ -594,11 +604,11 @@ wsReadInput(InputInfoPtr pInfo) break; case WSCONS_EVENT_MOUSE_ABSOLUTE_X: DBG(4, ErrorF("Absolute X %d\n", event->value)); - if (event->value != 4095) { - ax = event->value; - if (priv->inv_x) - ax = priv->max_x - ax + priv->min_x; - } + if (event->value == 4095) + break; + ax = event->value; + if (priv->inv_x) + ax = priv->max_x - ax + priv->min_x; break; case WSCONS_EVENT_MOUSE_ABSOLUTE_Y: DBG(4, ErrorF("Absolute Y %d\n", event->value)); @@ -678,6 +688,13 @@ wsReadInput(InputInfoPtr pInfo) buttons &= ~zbutton; wsSendButtons(pInfo, buttons); } + if (priv->swap_axes) { + int tmp; + + tmp = ax; + ax = ay; + ay = tmp; + } if (ax) { /* absolute position event */ DBG(3, ErrorF("postMotionEvent X %d\n", ax)); @@ -842,10 +859,17 @@ wsSetProperty(DeviceIntPtr device, Atom atom, XIPropertyValuePtr val, need_update++; } /* Update axes descriptors */ - ax->min_value = priv->min_x; - ax->max_value = priv->max_x; - ay->min_value = priv->min_y; - ay->max_value = priv->max_y; + if (!priv->swap_axes) { + ax->min_value = priv->min_x; + ax->max_value = priv->max_x; + ay->min_value = priv->min_y; + ay->max_value = priv->max_y; + } else { + ax->min_value = priv->min_y; + ax->max_value = priv->max_y; + ay->min_value = priv->min_x; + ay->max_value = priv->max_x; + } } } else if (atom == prop_swap) { if (val->format != 8 || val->type != XA_INTEGER || |