summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2010-07-16 09:21:19 -0400
committerPeter Hutterer <peter.hutterer@who-t.net>2010-10-22 13:37:57 +1000
commit65c0fc81eb920085e650b8c9e874c9dd26c7ec98 (patch)
treeac513fa8127b4dc8d4e8003d3cd4f1be21fe060e /Xi
parent9696c782c8cb86b06d12949899582533a2e04cfe (diff)
Add support for per-axis valuator modes (Relative/Absolute)
The XI2 protocol supports per-axis modes, but the server so far does not. This change adds support in the server. A complication is the fact that XI1 does not support per-axis modes. The solution provided here is to set a per-device mode that defines the mode of at least the first two valuators (X and Y). Note that initializing the first two axes to a different mode than the device mode will fail. For XI1 events, any axes following the first two that have the same mode will be sent to clients, up to the first axis that has a different mode. Thus, if a device has relative, then absolute, then relative mode axes, only the first block of relative axes will be sent over XI1. Since the XI2 protocol supports per-axis modes, all axes are sent to the client. Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c3
-rw-r--r--Xi/xiquerydevice.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 9689ef8f8..1f59001cf 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1127,7 +1127,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
*/
void
InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
- int resolution, int min_res, int max_res)
+ int resolution, int min_res, int max_res, int mode)
{
AxisInfoPtr ax;
@@ -1144,6 +1144,7 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int
ax->min_resolution = min_res;
ax->max_resolution = max_res;
ax->label = label;
+ ax->mode = mode;
}
static void
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 303c8b27d..c8b3d7e1b 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -349,7 +349,7 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber,
info->value.frac = (int)(v->axisVal[axisnumber] * (1 << 16) * (1 << 16));
info->resolution = v->axes[axisnumber].resolution;
info->number = axisnumber;
- info->mode = v->mode; /* Server doesn't have per-axis mode yet */
+ info->mode = v->axes[axisnumber].mode;
info->sourceid = v->sourceid;
if (!reportState)