From e9f205f952efac448974239526c5284134ae41b9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 12 Sep 2022 16:19:44 +0200 Subject: [PATCH] Avoid using XIWarpPointer on certain setups where it's broken fixes minetest/minetest#12697 --- source/Irrlicht/CIrrDeviceLinux.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp index 6d4c1a7c..d500af06 100644 --- a/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/source/Irrlicht/CIrrDeviceLinux.cpp @@ -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;