mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-25 02:00:30 +01:00
Simplify touch-event handling a bit.
Discussion to this in https://sourceforge.net/p/irrlicht/patches/322 Basically last solution caused problems as it send fake-mouse events on top of touch-events. For now we can probably just enable touch-events and clear masks for everything else for all devices as we only use the XInput2 events for touch-event handling and nothing else. At least not noticing conflicts with rest of X11 input so far and user TheBrokenRail said this works for him. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6184 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
af380df28f
commit
81a392928b
@ -1992,28 +1992,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);
|
||||||
@ -2021,10 +2005,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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user