Xi: Make check_for_touch_selection_conflicts() more generic

This commit is contained in:
Povilas Kanapickas 2020-10-10 02:51:34 +03:00 committed by Peter Hutterer
parent 56d7205921
commit f6e0bf6833

View File

@ -44,7 +44,9 @@
* - If A has XIAllMasterDevices, B may select on XIAllDevices * - If A has XIAllMasterDevices, B may select on XIAllDevices
* - if A has device X, B may select on XIAllDevices/XIAllMasterDevices * - if A has device X, B may select on XIAllDevices/XIAllMasterDevices
*/ */
static int check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int deviceid) static int
check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int deviceid,
int evtype)
{ {
OtherInputMasks *inputMasks = wOtherInputMasks(win); OtherInputMasks *inputMasks = wOtherInputMasks(win);
InputClients *A = NULL; InputClients *A = NULL;
@ -67,19 +69,19 @@ static int check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int d
return BadImplementation; /* this shouldn't happen */ return BadImplementation; /* this shouldn't happen */
/* A has XIAllDevices */ /* A has XIAllDevices */
if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_devices, XI_TouchBegin)) { if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_devices, evtype)) {
if (deviceid == XIAllDevices) if (deviceid == XIAllDevices)
return BadAccess; return BadAccess;
} }
/* A has XIAllMasterDevices */ /* A has XIAllMasterDevices */
if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_master_devices, XI_TouchBegin)) { if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_master_devices, evtype)) {
if (deviceid == XIAllMasterDevices) if (deviceid == XIAllMasterDevices)
return BadAccess; return BadAccess;
} }
/* A has this device */ /* A has this device */
if (xi2mask_isset_for_device(A->xi2mask, tmp, XI_TouchBegin)) if (xi2mask_isset_for_device(A->xi2mask, tmp, evtype))
return BadAccess; return BadAccess;
} }
@ -230,7 +232,8 @@ ProcXISelectEvents(ClientPtr client)
if (BitIsOn(bits, XI_TouchBegin)) { if (BitIsOn(bits, XI_TouchBegin)) {
rc = check_for_touch_selection_conflicts(client, rc = check_for_touch_selection_conflicts(client,
win, win,
evmask->deviceid); evmask->deviceid,
XI_TouchBegin);
if (rc != Success) if (rc != Success)
return rc; return rc;
} }