diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-15 08:06:31 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-15 08:40:38 +1000 |
commit | 43802719b9b1a02c386a57b29b86a81a41766208 (patch) | |
tree | 459f079315587c05190cd900924fdb4d919e3052 | |
parent | 35a7172becb6cf49018028878d9f25e33f8688bf (diff) |
Drop xaxis/yaxis from the TouchClassRecmultitouch-devel-history
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | Xi/exevents.c | 30 | ||||
-rw-r--r-- | dix/devices.c | 2 | ||||
-rw-r--r-- | dix/getevents.c | 79 | ||||
-rw-r--r-- | dix/touch.c | 8 | ||||
-rw-r--r-- | include/inputstr.h | 2 |
5 files changed, 54 insertions, 67 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index e1affbf0a..08034bf82 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1113,12 +1113,10 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti, ti->pending_finish) { int flags; - int xaxis = dev->touch->x_axis, - yaxis = dev->touch->y_axis; - valuator_mask_set_double(mask, xaxis, - valuator_mask_get_double(ti->valuators, xaxis)); - valuator_mask_set_double(mask, yaxis, - valuator_mask_get_double(ti->valuators, yaxis)); + valuator_mask_set_double(mask, 0, + valuator_mask_get_double(ti->valuators, 0)); + valuator_mask_set_double(mask, 1, + valuator_mask_get_double(ti->valuators, 1)); flags = TOUCH_CLIENT_ID; if (ti->emulate_pointer) @@ -1149,12 +1147,10 @@ TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, if (ti->listeners[0].state != LISTENER_HAS_END) { int flags; - int xaxis = sourcedev->touch->x_axis, - yaxis = sourcedev->touch->y_axis; - valuator_mask_set_double(mask, xaxis, - valuator_mask_get_double(ti->valuators, xaxis)); - valuator_mask_set_double(mask, yaxis, - valuator_mask_get_double(ti->valuators, yaxis)); + valuator_mask_set_double(mask, 0, + valuator_mask_get_double(ti->valuators, 0)); + valuator_mask_set_double(mask, 1, + valuator_mask_get_double(ti->valuators, 1)); flags = TOUCH_CLIENT_ID|TOUCH_REJECT; if (ti->emulate_pointer) @@ -1212,16 +1208,14 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags; int nev, i; ValuatorMask *mask; - int xaxis = dev->touch->x_axis, - yaxis = dev->touch->y_axis; InternalEvent *tel = InitEventList(GetMaximumEventsNum()); mask = valuator_mask_new(dev->valuator->numAxes); - valuator_mask_set_double(mask, xaxis, - valuator_mask_get_double(ti->valuators, xaxis)); - valuator_mask_set_double(mask, yaxis, - valuator_mask_get_double(ti->valuators, yaxis)); + valuator_mask_set_double(mask, 0, + valuator_mask_get_double(ti->valuators, 0)); + valuator_mask_set_double(mask, 1, + valuator_mask_get_double(ti->valuators, 1)); /* FIXME: what about early acceptance? a client may accept before it * owns the touch. */ diff --git a/dix/devices.c b/dix/devices.c index 92a94e439..d565fecc3 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1608,8 +1608,6 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches, TouchInitTouchPoint(touch, device->valuator, i); touch->mode = mode; - touch->x_axis = -1; - touch->y_axis = -1; touch->sourceid = device->id; device->touch = touch; diff --git a/dix/getevents.c b/dix/getevents.c index 5aefb8638..7b85be79f 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -791,30 +791,28 @@ accelPointer(DeviceIntPtr dev, ValuatorMask* valuators, CARD32 ms) * @param dev The device to scale for. * @param[in, out] mask The mask in desktop coordinates, modified in place * to contain device coordinate range. - * @param xaxis Axis number for x axis (0-indexed) - * @param yaxis Axis number for y axis (0-indexed) */ static void -scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask, int xaxis, int yaxis) +scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask) { double scaled; ScreenPtr scr = miPointerGetScreen(dev); - if (valuator_mask_isset(mask, xaxis)) + if (valuator_mask_isset(mask, 0)) { - scaled = valuator_mask_get_double(mask, xaxis) + scr->x; + scaled = valuator_mask_get_double(mask, 0) + scr->x; scaled = rescaleValuatorAxis(scaled, - NULL, dev->valuator->axes + xaxis, + NULL, dev->valuator->axes + 0, 0, scr->width); - valuator_mask_set_double(mask, xaxis, scaled); + valuator_mask_set_double(mask, 0, scaled); } - if (valuator_mask_isset(mask, yaxis)) + if (valuator_mask_isset(mask, 1)) { - scaled = valuator_mask_get_double(mask, yaxis) + scr->y; + scaled = valuator_mask_get_double(mask, 1) + scr->y; scaled = rescaleValuatorAxis(scaled, - NULL, dev->valuator->axes + yaxis, + NULL, dev->valuator->axes + 1, 0, scr->height); - valuator_mask_set_double(mask, yaxis, scaled); + valuator_mask_set_double(mask, 1, scaled); } } @@ -845,7 +843,6 @@ scale_from_screen(DeviceIntPtr dev, ValuatorMask *mask, int xaxis, int yaxis) */ static ScreenPtr positionSprite(DeviceIntPtr dev, Bool update, int mode, ValuatorMask *mask, - int xaxis, int yaxis, double *devx, double *devy, double *screenx, double *screeny) { @@ -856,19 +853,19 @@ positionSprite(DeviceIntPtr dev, Bool update, int mode, ValuatorMask *mask, if (!dev->valuator || dev->valuator->numAxes < 2) return scr; - if (valuator_mask_isset(mask, xaxis)) - x = valuator_mask_get_double(mask, xaxis); + if (valuator_mask_isset(mask, 0)) + x = valuator_mask_get_double(mask, 0); else - x = dev->last.valuators[xaxis]; - if (valuator_mask_isset(mask, yaxis)) - y = valuator_mask_get_double(mask, yaxis); + x = dev->last.valuators[0]; + if (valuator_mask_isset(mask, 1)) + y = valuator_mask_get_double(mask, 1); else - y = dev->last.valuators[yaxis]; + y = dev->last.valuators[1]; /* scale x&y to desktop coordinates */ - *screenx = rescaleValuatorAxis(x, dev->valuator->axes + xaxis, NULL, + *screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL, screenInfo.x, screenInfo.width); - *screeny = rescaleValuatorAxis(y, dev->valuator->axes + yaxis, NULL, + *screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL, screenInfo.y, screenInfo.height); tmpx = *screenx; @@ -889,23 +886,23 @@ positionSprite(DeviceIntPtr dev, Bool update, int mode, ValuatorMask *mask, * crossing this doesn't matter much, the coords would be 0 or max. */ if (tmpx != *screenx) - *devx = rescaleValuatorAxis(*screenx, NULL, dev->valuator->axes + xaxis, + *devx = rescaleValuatorAxis(*screenx, NULL, dev->valuator->axes + 0, screenInfo.x, screenInfo.width); if (tmpy != *screeny) - *devy = rescaleValuatorAxis(*screeny, NULL, dev->valuator->axes + yaxis, + *devy = rescaleValuatorAxis(*screeny, NULL, dev->valuator->axes + 1, screenInfo.y, screenInfo.height); /* Recalculate the per-screen device coordinates */ - if (valuator_mask_isset(mask, xaxis)) { - x = rescaleValuatorAxis(*screenx - scr->x, NULL, dev->valuator->axes + xaxis, + if (valuator_mask_isset(mask, 0)) { + x = rescaleValuatorAxis(*screenx - scr->x, NULL, dev->valuator->axes + 0, 0, scr->width); - valuator_mask_set_double(mask, xaxis, x); + valuator_mask_set_double(mask, 0, x); } - if (valuator_mask_isset(mask, yaxis)) { - y = rescaleValuatorAxis(*screeny - scr->y, NULL, dev->valuator->axes + yaxis, + if (valuator_mask_isset(mask, 1)) { + y = rescaleValuatorAxis(*screeny - scr->y, NULL, dev->valuator->axes + 1, 0, scr->height); - valuator_mask_set_double(mask, yaxis, y); + valuator_mask_set_double(mask, 1, y); } return scr; @@ -1276,7 +1273,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, if (flags & POINTER_ABSOLUTE) { if (flags & POINTER_SCREEN) /* valuators are in screen coords */ - scale_from_screen(pDev, &mask, 0, 1); + scale_from_screen(pDev, &mask); transformAbsolute(pDev, &mask); clipAbsolute(pDev, &mask); @@ -1292,7 +1289,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, set_raw_valuators(raw, &mask, raw->valuators.data); scr = positionSprite(pDev, TRUE, (flags & POINTER_ABSOLUTE) ? Absolute : Relative, - &mask, 0, 1, &devx, &devy, &screenx, &screeny); + &mask, &devx, &devy, &screenx, &screeny); /* screenx, screeny are in desktop coordinates, mask is in device coordinates per-screen (the event data) @@ -1715,7 +1712,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, int need_rawevent = TRUE; Bool emulate_pointer = FALSE; - if (!dev->enabled || !t || !v || t->x_axis == -1 || t->y_axis == -1) + if (!dev->enabled || !t || !v) return 0; /* Find and/or create the DDX touch info */ @@ -1729,8 +1726,8 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, return 0; if (!mask_in || - !valuator_mask_isset(mask_in, t->x_axis) || - !valuator_mask_isset(mask_in, t->y_axis)) + !valuator_mask_isset(mask_in, 0) || + !valuator_mask_isset(mask_in, 1)) { ErrorF("[dix] dix-submitted events must have x/y valuator information.\n"); return 0; @@ -1783,8 +1780,8 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, event->type = ET_TouchBegin; /* If we're starting a touch, we must have x & y co-ordinates. */ if (!mask_in || - !valuator_mask_isset(mask_in, t->x_axis) || - !valuator_mask_isset(mask_in, t->y_axis)) + !valuator_mask_isset(mask_in, 0) || + !valuator_mask_isset(mask_in, 1)) { DebugF("%s: Attempted to start touch without x/y (driver bug)\n", dev->name); @@ -1811,10 +1808,10 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, } if (!(flags & TOUCH_CLIENT_ID)) { - if (!valuator_mask_isset(&mask, t->x_axis)) - valuator_mask_set_double(&mask, t->x_axis, valuator_mask_get_double(touchpoint.ti->valuators, t->x_axis)); - if (!valuator_mask_isset(&mask, t->y_axis)) - valuator_mask_set_double(&mask, t->y_axis, valuator_mask_get_double(touchpoint.ti->valuators, t->y_axis)); + if (!valuator_mask_isset(&mask, 0)) + valuator_mask_set_double(&mask, 0, valuator_mask_get_double(touchpoint.ti->valuators, 0)); + if (!valuator_mask_isset(&mask, 1)) + valuator_mask_set_double(&mask, 1, valuator_mask_get_double(touchpoint.ti->valuators, 1)); } @@ -1841,13 +1838,13 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, if (need_rawevent) set_raw_valuators(raw, &mask, raw->valuators.data); - scr = positionSprite(dev, emulate_pointer, Absolute, &mask, t->x_axis, t->y_axis, + scr = positionSprite(dev, emulate_pointer, Absolute, &mask, &devx, &devy, &screenx, &screeny); /* see fill_pointer_events for coordinate systems */ updateHistory(dev, &mask, ms); clipValuators(dev, &mask); - storeLastValuators(dev, &mask, t->x_axis, t->y_axis, devx, devy); + storeLastValuators(dev, &mask, 0, 1, devx, devy); event->root = scr->root->drawable.id; diff --git a/dix/touch.c b/dix/touch.c index 65c43a014..fe39924c2 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -479,10 +479,10 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource) if (!ti->history) return; - valuator_mask_set_double(mask, dev->touch->x_axis, - ti->history[0].valuators.data[dev->touch->x_axis]); - valuator_mask_set_double(mask, dev->touch->y_axis, - ti->history[0].valuators.data[dev->touch->y_axis]); + valuator_mask_set_double(mask, 0, + ti->history[0].valuators.data[0]); + valuator_mask_set_double(mask, 1, + ti->history[0].valuators.data[1]); flags = TOUCH_CLIENT_ID|TOUCH_REPLAYING; if (ti->emulate_pointer) diff --git a/include/inputstr.h b/include/inputstr.h index a03389392..9881c7e46 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -343,8 +343,6 @@ typedef struct _TouchClassRec { unsigned short num_touches; /* number of allocated touches */ unsigned short max_touches; /* maximum number of touches, may be 0 */ CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */ - int x_axis; /* axis number of x axis */ - int y_axis; /* axis number of y axis */ /* for pointer-emulation */ CARD8 buttonsDown; /* number of buttons down */ unsigned short state; /* logical button state */ |