diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 05caf67e1..6a54bf200 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -808,7 +808,6 @@ std::array x11_to_xt_vnc 0, 0, 0, - 0, 0x1D, 0x11D, 0x2A, diff --git a/src/qt/xinput2_mouse.cpp b/src/qt/xinput2_mouse.cpp index 361917bfc..ff67b6a2c 100644 --- a/src/qt/xinput2_mouse.cpp +++ b/src/qt/xinput2_mouse.cpp @@ -34,6 +34,7 @@ extern MainWindow* main_window; extern "C" { #include +#include #include #include #include @@ -50,7 +51,7 @@ static QThread* procThread = nullptr; static bool xi2childinit = false; static XIEventMask ximask; static std::atomic exitfromthread = false; -static std::atomic xi2_mouse_x = 0, xi2_mouse_y = 0; +static std::atomic xi2_mouse_x = 0, xi2_mouse_y = 0, xi2_mouse_abs_x = 0, xi2_mouse_abs_y = 0; static int xi2opcode = 0; static double prev_rel_coords[2] = { 0., 0. }; static Time prev_time = 0; @@ -91,6 +92,7 @@ void xinput2_proc() XISetMask(ximask.mask, XI_RawButtonPress); XISetMask(ximask.mask, XI_RawButtonRelease); XISetMask(ximask.mask, XI_RawMotion); + if (XKeysymToKeycode(disp, XK_Home) == 69) XISetMask(ximask.mask, XI_Motion); XISelectEvents(disp, win, &ximask, 1); @@ -119,6 +121,18 @@ void xinput2_proc() prev_rel_coords[1] = relative_coords[1]; prev_time = rawev->time; } + case XI_Motion: { + if (XKeysymToKeycode(disp, XK_Home) == 69) { + // No chance we will get raw motion events on VNC. + const XIDeviceEvent *motionev = (const XIDeviceEvent*)cookie->data; + if (xi2_mouse_abs_x != 0 || xi2_mouse_abs_y != 0) { + xi2_mouse_x = xi2_mouse_x + (motionev->event_x - xi2_mouse_abs_x); + xi2_mouse_y = xi2_mouse_y + (motionev->event_y - xi2_mouse_abs_y); + } + xi2_mouse_abs_x = motionev->event_x; + xi2_mouse_abs_y = motionev->event_y; + } + } } }