summaryrefslogtreecommitdiff
path: root/Xi/chgdctl.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-02-27 20:43:50 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-02-28 15:47:26 +1030
commit453661a9e193a511cf5e54e6d330454163817316 (patch)
treed0aacee040c472e5898abb82ef085d3a2f48d29f /Xi/chgdctl.c
parentaebd9dc252449747416b23c740a550d914275399 (diff)
Xi: swap the control attached to a ChangeDeviceControl request. Bug #14170
Just swapping the request's data isn't enough, we need to swap the actual control as well. X.Org Bug 14170 <http://bugs.freedesktop.org/show_bug.cgi?id=14170>
Diffstat (limited to 'Xi/chgdctl.c')
-rw-r--r--Xi/chgdctl.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 30174f496..89410d68f 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -77,11 +77,46 @@ int
SProcXChangeDeviceControl(ClientPtr client)
{
char n;
+ xDeviceCtl *ctl;
+ xDeviceAbsCalibCtl *calib;
+ xDeviceAbsAreaCtl *area;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
swaps(&stuff->control, n);
+ ctl = (xDeviceCtl*)&stuff[1];
+ swaps(&ctl->control, n);
+ swaps(&ctl->length, n);
+ switch(stuff->control) {
+ case DEVICE_ABS_CALIB:
+ calib = (xDeviceAbsCalibCtl*)ctl;
+ swaps(&calib->length, n);
+ swapl(&calib->min_x, n);
+ swapl(&calib->max_x, n);
+ swapl(&calib->min_y, n);
+ swapl(&calib->max_y, n);
+ swapl(&calib->flip_x, n);
+ swapl(&calib->flip_y, n);
+ swapl(&calib->rotation, n);
+ swapl(&calib->button_threshold, n);
+ break;
+ case DEVICE_ABS_AREA:
+ area = (xDeviceAbsAreaCtl*)ctl;
+ swapl(&area->offset_x, n);
+ swapl(&area->offset_y, n);
+ swapl(&area->width, n);
+ swapl(&area->height, n);
+ swapl(&area->screen, n);
+ swapl(&area->following, n);
+ break;
+ case DEVICE_CORE:
+ case DEVICE_ENABLE:
+ case DEVICE_RESOLUTION:
+ /* hmm. beer. *drool* */
+ break;
+
+ }
return (ProcXChangeDeviceControl(client));
}