Avoid using XIWarpPointer on certain setups where it's broken

fixes minetest/minetest#12697
This commit is contained in:
sfan5 2022-09-12 16:19:44 +02:00
parent d733e03430
commit e9f205f952

@ -2118,7 +2118,17 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
if (!Null)
{
#ifdef _IRR_LINUX_X11_XINPUT2_
XIGetClientPointer(Device->XDisplay, Device->XWindow, &DeviceId);
// XIWarpPointer is entirely broken on multi-head setups (see also [1]),
// but behaves better in other cases so we can't just disable it outright.
// [1] https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea
if (XScreenCount(Device->XDisplay) > 1)
{
os::Printer::log("Detected classic multi-head setup, not using XIWarpPointer");
}
else
{
XIGetClientPointer(Device->XDisplay, Device->XWindow, &DeviceId);
}
#endif
XGCValues values;