summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xi/chgdctl.c52
-rw-r--r--Xi/getdctl.c87
-rw-r--r--Xi/getdctl.h11
-rw-r--r--dix/devices.c33
-rw-r--r--hw/xfree86/common/xf86Xinput.c3
-rw-r--r--include/input.h2
-rw-r--r--include/inputstr.h18
7 files changed, 152 insertions, 54 deletions
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index ebe086548..32533c496 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -104,7 +104,8 @@ ProcXChangeDeviceControl(ClientPtr client)
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
- xDeviceTSCtl *ts;
+ xDeviceAbsCalibCtl *calib;
+ xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
REQUEST(xChangeDeviceControlReq);
@@ -170,25 +171,52 @@ ProcXChangeDeviceControl(ClientPtr client)
return Success;
}
break;
- case DEVICE_TOUCHSCREEN:
- ts = (xDeviceTSCtl *)&stuff[1];
+ case DEVICE_ABS_CALIB:
+ calib = (xDeviceAbsCalibCtl *)&stuff[1];
- if (ts->button_threshold < 0 || ts->button_threshold > 255) {
+ if (calib->button_threshold < 0 || calib->button_threshold > 255) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
return Success;
}
- status = ChangeDeviceControl(client, dev, (xDeviceCtl *) ts);
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
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;
+ dev->absolute->min_x = calib->min_x;
+ dev->absolute->max_x = calib->max_x;
+ dev->absolute->min_y = calib->min_y;
+ dev->absolute->max_y = calib->max_y;
+ dev->absolute->flip_x = calib->flip_x;
+ dev->absolute->flip_y = calib->flip_y;
+ dev->absolute->rotation = calib->rotation;
+ dev->absolute->button_threshold = calib->button_threshold;
+ } else if (status == DeviceBusy || status == BadValue) {
+ rep.status = status;
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+ &rep);
+ return Success;
+ } else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ break;
+ case DEVICE_ABS_AREA:
+ area = (xDeviceAbsAreaCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) area);
+
+ if (status == Success) {
+ dev->absolute->offset_x = area->offset_x;
+ dev->absolute->offset_y = area->offset_y;
+ dev->absolute->width = area->width;
+ dev->absolute->height = area->height;
+ dev->absolute->screen = area->screen;
+ dev->absolute->following = area->following;
+ } else if (status == DeviceBusy || status == BadValue) {
+ rep.status = status;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 66342b340..61798f274 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -124,14 +124,23 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
- case DEVICE_TOUCHSCREEN:
- if (!dev->touchscreen) {
+ case DEVICE_ABS_CALIB:
+ if (!dev->absolute) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
- total_length = sizeof(xDeviceTSCtl);
+ total_length = sizeof(xDeviceAbsCalibCtl);
+ break;
+ case DEVICE_ABS_AREA:
+ if (!dev->absolute) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ total_length = sizeof(xDeviceAbsAreaCtl);
break;
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
@@ -152,8 +161,11 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
- case DEVICE_TOUCHSCREEN:
- CopySwapDeviceTouchscreen(client, dev->touchscreen, buf);
+ case DEVICE_ABS_CALIB:
+ CopySwapDeviceAbsCalib(client, dev->absolute, buf);
+ break;
+ case DEVICE_ABS_AREA:
+ CopySwapDeviceAbsArea(client, dev->absolute, buf);
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
@@ -206,28 +218,61 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
}
}
-void CopySwapDeviceTouchscreen (ClientPtr client, TouchscreenClassPtr dts,
+void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
+ char *buf)
+{
+ register char n;
+ xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
+
+ calib->control = DEVICE_ABS_CALIB;
+ calib->length = sizeof(calib);
+ calib->min_x = dts->min_x;
+ calib->max_x = dts->max_x;
+ calib->min_y = dts->min_y;
+ calib->max_y = dts->max_y;
+ calib->flip_x = dts->flip_x;
+ calib->flip_y = dts->flip_y;
+ calib->rotation = dts->rotation;
+ calib->button_threshold = dts->button_threshold;
+
+ if (client->swapped) {
+ swaps(&calib->control, n);
+ 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);
+ }
+}
+
+void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
char *buf)
{
register char n;
- xDeviceTSState *ts = (xDeviceTSState *) buf;
+ xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) 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;
+ area->control = DEVICE_ABS_AREA;
+ area->length = sizeof(area);
+ area->offset_x = dts->offset_x;
+ area->offset_y = dts->offset_y;
+ area->width = dts->width;
+ area->height = dts->height;
+ area->screen = dts->screen;
+ area->following = dts->following;
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);
+ swaps(&area->control, n);
+ swaps(&area->length, n);
+ 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);
}
}
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index 1417d1b38..f6febb2b6 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -42,10 +42,13 @@ void CopySwapDeviceResolution(ClientPtr /* client */ ,
int /* length */
);
-void CopySwapDeviceTouchscreen(ClientPtr /* client */ ,
- TouchscreenClassPtr /* ts */ ,
- char * /* buf */
- );
+void CopySwapDeviceAbsCalib (ClientPtr client,
+ AbsoluteClassPtr dts,
+ char *buf);
+
+void CopySwapDeviceAbsArea (ClientPtr client,
+ AbsoluteClassPtr dts,
+ char *buf);
void CopySwapDeviceCore(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
diff --git a/dix/devices.c b/dix/devices.c
index 0121eea97..bf7592bca 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -116,7 +116,7 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
dev->button = (ButtonClassPtr)NULL;
dev->focus = (FocusClassPtr)NULL;
dev->proximity = (ProximityClassPtr)NULL;
- dev->touchscreen = (TouchscreenClassPtr)NULL;
+ dev->absolute = (AbsoluteClassPtr)NULL;
dev->kbdfeed = (KbdFeedbackPtr)NULL;
dev->ptrfeed = (PtrFeedbackPtr)NULL;
dev->intfeed = (IntegerFeedbackPtr)NULL;
@@ -805,22 +805,31 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
}
_X_EXPORT Bool
-InitTouchscreenClassDeviceStruct(DeviceIntPtr dev)
+InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
{
- register TouchscreenClassPtr tsc;
+ register AbsoluteClassPtr abs;
- tsc = (TouchscreenClassPtr)xalloc(sizeof(TouchscreenClassRec));
- if (!tsc)
+ abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec));
+ if (!abs)
return FALSE;
/* we don't do anything sensible with these, but should */
- tsc->min_x = -1;
- tsc->min_y = -1;
- tsc->max_x = -1;
- tsc->max_y = -1;
-
- tsc->button_threshold = 0;
- dev->touchscreen = tsc;
+ abs->min_x = -1;
+ abs->min_y = -1;
+ abs->max_x = -1;
+ abs->max_y = -1;
+ abs->flip_x = 0;
+ abs->flip_y = 0;
+ abs->rotation = 0;
+ abs->button_threshold = 0;
+
+ abs->offset_x = 0;
+ abs->offset_y = 0;
+ abs->width = -1;
+ abs->height = -1;
+ abs->following = 0;
+
+ dev->absolute = abs;
return TRUE;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 411deddab..8a5d5b30a 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -529,7 +529,8 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
switch (control->control) {
case DEVICE_CORE:
case DEVICE_RESOLUTION:
- case DEVICE_TOUCHSCREEN:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
return Success;
default:
return BadMatch;
diff --git a/include/input.h b/include/input.h
index 3e3d16d2b..79e1de25c 100644
--- a/include/input.h
+++ b/include/input.h
@@ -236,7 +236,7 @@ extern Bool InitValuatorClassDeviceStruct(
int /*numMotionEvents*/,
int /*mode*/);
-extern Bool InitTouchscreenClassDeviceStruct(
+extern Bool InitAbsoluteClassDeviceStruct(
DeviceIntPtr /*device*/);
extern Bool InitFocusClassDeviceStruct(
diff --git a/include/inputstr.h b/include/inputstr.h
index e12b64195..1aa16d4a4 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -184,13 +184,25 @@ typedef struct _ProximityClassRec {
char pad;
} ProximityClassRec, *ProximityClassPtr;
-typedef struct _TouchscreenClassRec {
+typedef struct _AbsoluteClassRec {
+ /* Calibration. */
int min_x;
int max_x;
int min_y;
int max_y;
+ int flip_x;
+ int flip_y;
+ int rotation;
int button_threshold;
-} TouchscreenClassRec, *TouchscreenClassPtr;
+
+ /* Area. */
+ int offset_x;
+ int offset_y;
+ int width;
+ int height;
+ int screen;
+ XID following;
+} AbsoluteClassRec, *AbsoluteClassPtr;
typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
@@ -292,7 +304,7 @@ typedef struct _DeviceIntRec {
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
- TouchscreenClassPtr touchscreen;
+ AbsoluteClassPtr absolute;
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;