input: add a TouchClassRec to the devices
These structs will be used to store touch-related data, events and information. Drivers must call InitTouchClassDeviceStruct to set up a multi-touch capable device. Touchpoints for the DDX and the DIX are handled separately - touchpoints submitted by the driver/DDX will be stored in the DDXTouchPointInfoRec. Once the touchpoints are processed by the DIX, new TouchPointInfoRecs are created and stored. This process is already used for pointer events with the last.valuators field. Note that this patch does not actually add the generation of touch events, only the required structs. TouchListeners are (future) recipients of touch or emulated pointer events. Each listener is in a state, depending which event they have already received. The type of listener defines how the listener got to be one. Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
committed by
Peter Hutterer
parent
098b837440
commit
3fb258ca28
@@ -240,6 +240,8 @@ SizeDeviceClasses(DeviceIntPtr dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->touch)
|
||||
len += sizeof(xXITouchInfo);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -427,6 +429,31 @@ SwapScrollInfo(DeviceIntPtr dev, xXIScrollInfo* info)
|
||||
swapl(&info->increment.frac);
|
||||
}
|
||||
|
||||
/**
|
||||
* List multitouch information
|
||||
*
|
||||
* @return The number of bytes written into info.
|
||||
*/
|
||||
int
|
||||
ListTouchInfo(DeviceIntPtr dev, xXITouchInfo *touch)
|
||||
{
|
||||
touch->type = XITouchClass;
|
||||
touch->length = sizeof(xXITouchInfo) >> 2;
|
||||
touch->sourceid = touch->sourceid;
|
||||
touch->mode = dev->touch->mode;
|
||||
touch->num_touches = dev->touch->num_touches;
|
||||
|
||||
return touch->length << 2;
|
||||
}
|
||||
|
||||
static void
|
||||
SwapTouchInfo(DeviceIntPtr dev, xXITouchInfo* touch)
|
||||
{
|
||||
swaps(&touch->type);
|
||||
swaps(&touch->length);
|
||||
swaps(&touch->sourceid);
|
||||
}
|
||||
|
||||
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
|
||||
{
|
||||
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
|
||||
@@ -525,6 +552,14 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
|
||||
total_len += len;
|
||||
}
|
||||
|
||||
if (dev->touch)
|
||||
{
|
||||
(*nclasses)++;
|
||||
len = ListTouchInfo(dev, (xXITouchInfo*)any);
|
||||
any += len;
|
||||
total_len += len;
|
||||
}
|
||||
|
||||
return total_len;
|
||||
}
|
||||
|
||||
@@ -554,6 +589,10 @@ SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
|
||||
case XIScrollClass:
|
||||
SwapScrollInfo(dev, (xXIScrollInfo*)any);
|
||||
break;
|
||||
case XITouchClass:
|
||||
SwapTouchInfo(dev, (xXITouchInfo*)any);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
any += len * 4;
|
||||
|
||||
Reference in New Issue
Block a user