]> git.lizzy.rs Git - irrlicht.git/commitdiff
Avoid using XIWarpPointer on certain setups where it's broken
authorsfan5 <sfan5@live.de>
Mon, 12 Sep 2022 14:19:44 +0000 (16:19 +0200)
committersfan5 <sfan5@live.de>
Mon, 12 Sep 2022 14:20:31 +0000 (16:20 +0200)
fixes minetest/minetest#12697

source/Irrlicht/CIrrDeviceLinux.cpp

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