input: add valuator_get_mode() helper.

Returns the mode of the specified valuator.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Peter Hutterer 2010-10-22 13:57:27 +10:00
parent 6f6f460c24
commit 4381b70f5a
2 changed files with 26 additions and 0 deletions

View File

@ -2570,3 +2570,25 @@ AllocDevicePair (ClientPtr client, char* name,
return Success;
}
/**
* Return Relative or Absolute for the device.
*/
int valuator_get_mode(DeviceIntPtr dev, int axis)
{
return (dev->valuator->axes[axis].mode & DeviceMode);
}
/**
* Set the given mode for the axis. If axis is VALUATOR_MODE_ALL_AXES, then
* set the mode for all axes.
*/
void valuator_set_mode(DeviceIntPtr dev, int axis, int mode)
{
if (axis != VALUATOR_MODE_ALL_AXES)
dev->valuator->axes[axis].mode = mode;
else {
int i;
for (i = 0; i < dev->valuator->numAxes; i++)
dev->valuator->axes[axis].mode = mode;
}
}

View File

@ -546,6 +546,10 @@ extern _X_EXPORT void DDXRingBell(
int pitch,
int duration);
#define VALUATOR_MODE_ALL_AXES -1
extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
/* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
xfixes/cursor.c uses it to determine if the cursor is enabled */
extern Bool EnableCursor;