summaryrefslogtreecommitdiff
path: root/Xi/getdctl.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel.stone@nokia.com>2006-07-19 12:15:18 -0400
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-07-21 15:19:50 -0400
commitb308dbf273f8c26361b0fee7aca64aec3245f60b (patch)
treed81b973c4ff1149f08d876f7ae4d95060d8b6d1c /Xi/getdctl.c
parentc9a3d9baa81ceb940032ffe529d9eadf2d202ab2 (diff)
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.
Diffstat (limited to 'Xi/getdctl.c')
-rw-r--r--Xi/getdctl.c59
1 files changed, 59 insertions, 0 deletions
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,