From 16b9a5d3e04c1d6805ddea7ab1364dc3f9e8f212 Mon Sep 17 00:00:00 2001 From: "Joakim L. Gilje" Date: Mon, 13 Feb 2023 17:33:40 +0100 Subject: [PATCH] TigerVNC pointer needs the same workaround as previously added for another VNC server, (#3103) but it's pointer is named differently. In addition, it also publishes a pointer using the XTEST pointer name already added as a workaround. So, if a TigerVNC pointer is detected, it should be selected first. --- src/qt/xinput2_mouse.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qt/xinput2_mouse.cpp b/src/qt/xinput2_mouse.cpp index e73f36869..0ce51c5ab 100644 --- a/src/qt/xinput2_mouse.cpp +++ b/src/qt/xinput2_mouse.cpp @@ -81,9 +81,17 @@ xinput2_get_xtest_pointer() { /* The XTEST pointer events injected by VNC servers to move the cursor always report absolute coordinates, despite XTEST declaring relative axes (related: SDL issue 1836). - This looks for the XTEST pointer so that we can assume it's absolute as a workaround. */ + This looks for the XTEST pointer so that we can assume it's absolute as a workaround. + + TigerVNC publishes both the XTEST pointer and a TigerVNC pointer, but actual + RawMotion events are published using the TigerVNC pointer */ int devs; XIDeviceInfo *info = XIQueryDevice(disp, XIAllDevices, &devs), *dev; + for (int i = 0; i < devs; i++) { + dev = &info[i]; + if ((dev->use == XISlavePointer) && !strcmp(dev->name, "TigerVNC pointer")) + return dev->deviceid; + } for (int i = 0; i < devs; i++) { dev = &info[i]; if ((dev->use == XISlavePointer) && !strcmp(dev->name, "Virtual core XTEST pointer"))