Merging r6181 through r6184 from trunk to ogl-es branch

- Changes to touch-input handling on X11


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6185 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2021-01-06 14:52:49 +00:00
parent f1a58b706c
commit 838ecd6bf8

@ -2040,28 +2040,12 @@ void CIrrDeviceLinux::initXInput2()
return; return;
} }
int cnt = 0; // So far we only use XInput2 for touch events.
XIDeviceInfo *di = XIQueryDevice(XDisplay, XIAllDevices, &cnt); // So we enable those and disable all other events for now.
if ( di )
{
for (int i = 0; i < cnt; ++i)
{
bool hasTouchClass = false;
XIDeviceInfo *dev = &di[i];
for (int j = 0; j < dev->num_classes; ++j)
{
if (dev->classes[j]->type == XITouchClass)
{
hasTouchClass = true;
break;
}
}
if ( hasTouchClass )
{
XIEventMask eventMask; XIEventMask eventMask;
unsigned char mask[XIMaskLen(XI_TouchEnd)]; unsigned char mask[XIMaskLen(XI_TouchEnd)];
memset(mask, 0, sizeof(mask)); memset(mask, 0, sizeof(mask));
eventMask.deviceid = dev->deviceid; eventMask.deviceid = XIAllMasterDevices;
eventMask.mask_len = sizeof(mask); eventMask.mask_len = sizeof(mask);
eventMask.mask = mask; eventMask.mask = mask;
XISetMask(eventMask.mask, XI_TouchBegin); XISetMask(eventMask.mask, XI_TouchBegin);
@ -2069,10 +2053,6 @@ void CIrrDeviceLinux::initXInput2()
XISetMask(eventMask.mask, XI_TouchEnd); XISetMask(eventMask.mask, XI_TouchEnd);
XISelectEvents(XDisplay, XWindow, &eventMask, 1); XISelectEvents(XDisplay, XWindow, &eventMask, 1);
}
}
XIFreeDeviceInfo(di);
}
#endif #endif
} }