summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2021-05-30 13:26:47 +0300
committerPovilas Kanapickas <povilas@radix.lt>2021-05-30 13:46:59 +0300
commit7e692633fb9ab8e1ed2a88c3abb4fe04144c0a80 (patch)
tree7b668439c6f0cd701fc4ad91410bccc40be678a3 /Xi
parent0886254f96f40e59193ccbb0e3acbd5ae92dbaa3 (diff)
Xi: Implement gesture support for XIQueryDevice
Diffstat (limited to 'Xi')
-rw-r--r--Xi/xiquerydevice.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index fbb51fe81..5c6799a7c 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -234,6 +234,9 @@ SizeDeviceClasses(DeviceIntPtr dev)
if (dev->touch)
len += sizeof(xXITouchInfo);
+ if (dev->gesture)
+ len += sizeof(xXIGestureInfo);
+
return len;
}
@@ -464,6 +467,30 @@ SwapTouchInfo(DeviceIntPtr dev, xXITouchInfo * touch)
swaps(&touch->sourceid);
}
+/**
+ * List gesture information
+ *
+ * @return The number of bytes written into info.
+ */
+static int
+ListGestureInfo(DeviceIntPtr dev, xXIGestureInfo * gesture)
+{
+ gesture->type = XIGestureClass;
+ gesture->length = sizeof(xXIGestureInfo) >> 2;
+ gesture->sourceid = dev->gesture->sourceid;
+ gesture->num_touches = dev->gesture->max_touches;
+
+ return gesture->length << 2;
+}
+
+static void
+SwapGestureInfo(DeviceIntPtr dev, xXIGestureInfo * gesture)
+{
+ swaps(&gesture->type);
+ swaps(&gesture->length);
+ swaps(&gesture->sourceid);
+}
+
int
GetDeviceUse(DeviceIntPtr dev, uint16_t * attachment)
{
@@ -567,6 +594,13 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
total_len += len;
}
+ if (dev->gesture) {
+ (*nclasses)++;
+ len = ListGestureInfo(dev, (xXIGestureInfo *) any);
+ any += len;
+ total_len += len;
+ }
+
return total_len;
}
@@ -598,7 +632,9 @@ SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo * info)
case XITouchClass:
SwapTouchInfo(dev, (xXITouchInfo *) any);
break;
-
+ case XIGestureClass:
+ SwapGestureInfo(dev, (xXIGestureInfo *) any);
+ break;
}
any += len * 4;