From b308dbf273f8c26361b0fee7aca64aec3245f60b Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 19 Jul 2006 12:15:18 -0400 Subject: add DEVICE_TOUCHSCREEN and DEVICE_CORE Xi controls (DeviceIntRec ABI break) Add DEVICE_TOUCHSCREEN and DEVICE_CORE controls to the Xi code, and the TouchscreenClassRec and a coreEvents flag, to toggle propagation of core events. --- Xi/getdctl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'Xi/getdctl.c') diff --git a/Xi/getdctl.c b/Xi/getdctl.c index c2b69fd71..66342b340 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -124,6 +124,18 @@ ProcXGetDeviceControl(ClientPtr client) total_length = sizeof(xDeviceResolutionState) + (3 * sizeof(int) * dev->valuator->numAxes); break; + case DEVICE_TOUCHSCREEN: + if (!dev->touchscreen) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + + total_length = sizeof(xDeviceTSCtl); + break; + case DEVICE_CORE: + total_length = sizeof(xDeviceCoreCtl); + break; default: SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); return Success; @@ -140,6 +152,11 @@ ProcXGetDeviceControl(ClientPtr client) case DEVICE_RESOLUTION: CopySwapDeviceResolution(client, dev->valuator, buf, total_length); break; + case DEVICE_TOUCHSCREEN: + CopySwapDeviceTouchscreen(client, dev->touchscreen, buf); + break; + case DEVICE_CORE: + CopySwapDeviceCore(client, dev, buf); default: break; } @@ -189,6 +206,48 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, } } +void CopySwapDeviceTouchscreen (ClientPtr client, TouchscreenClassPtr dts, + char *buf) +{ + register char n; + xDeviceTSState *ts = (xDeviceTSState *) buf; + + ts->control = DEVICE_TOUCHSCREEN; + ts->length = sizeof(ts); + ts->min_x = dts->min_x; + ts->max_x = dts->max_x; + ts->min_y = dts->min_y; + ts->max_y = dts->max_y; + ts->button_threshold = dts->button_threshold; + + if (client->swapped) { + swaps(&ts->control, n); + swaps(&ts->length, n); + swapl(&ts->min_x, n); + swapl(&ts->max_x, n); + swapl(&ts->min_y, n); + swapl(&ts->max_y, n); + swapl(&ts->button_threshold, n); + } +} + +void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) +{ + register char n; + xDeviceCoreState *c = (xDeviceCoreState *) buf; + + c->control = DEVICE_CORE; + c->length = sizeof(c); + c->status = dev->coreEvents; + + if (client->swapped) { + swaps(&c->control, n); + swaps(&c->length, n); + swaps(&c->status, n); + } +} + + /*********************************************************************** * * This procedure writes the reply for the xGetDeviceControl function, -- cgit v1.2.3