summaryrefslogtreecommitdiff
path: root/Xi
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
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')
-rw-r--r--Xi/chgdctl.c50
-rw-r--r--Xi/getdctl.c59
-rw-r--r--Xi/getdctl.h10
-rw-r--r--Xi/stubs.c4
4 files changed, 123 insertions, 0 deletions
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index d507513a9..ebe086548 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -104,6 +104,8 @@ ProcXChangeDeviceControl(ClientPtr client)
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
+ xDeviceTSCtl *ts;
+ xDeviceCoreCtl *c;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -168,6 +170,54 @@ ProcXChangeDeviceControl(ClientPtr client)
return Success;
}
break;
+ case DEVICE_TOUCHSCREEN:
+ ts = (xDeviceTSCtl *)&stuff[1];
+
+ if (ts->button_threshold < 0 || ts->button_threshold > 255) {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+ BadValue);
+ return Success;
+ }
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) ts);
+
+ if (status == Success) {
+ dev->touchscreen->min_x = ts->min_x;
+ dev->touchscreen->max_x = ts->max_x;
+ dev->touchscreen->min_y = ts->min_y;
+ dev->touchscreen->max_y = ts->max_y;
+ dev->touchscreen->button_threshold = ts->button_threshold;
+ } else if (status == DeviceBusy) {
+ rep.status = DeviceBusy;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ } else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ break;
+ case DEVICE_CORE:
+ c = (xDeviceCoreCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) c);
+
+ if (status == Success) {
+ dev->coreEvents = c->status;
+ } else if (status == DeviceBusy) {
+ rep.status = DeviceBusy;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ } else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ break;
default:
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
return Success;
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,
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index c7cfb19d2..1417d1b38 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -42,6 +42,16 @@ void CopySwapDeviceResolution(ClientPtr /* client */ ,
int /* length */
);
+void CopySwapDeviceTouchscreen(ClientPtr /* client */ ,
+ TouchscreenClassPtr /* ts */ ,
+ char * /* buf */
+ );
+
+void CopySwapDeviceCore(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ char * /* buf */
+ );
+
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 6b9e682b9..90aeddbc7 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -287,6 +287,10 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
switch (control->control) {
case DEVICE_RESOLUTION:
return (BadMatch);
+ case DEVICE_TOUCHSCREEN:
+ return (BadMatch);
+ case DEVICE_CORE:
+ return (BadMatch);
default:
return (BadMatch);
}