XFCE Typing delay

Environment: high end PC running Mint 21 Vanessa with XFCE, xfwm4 version 4.16.1

Issue area: not sure if the bug is in xfwm4 but it seemed the most likely/applicable

Issue description:

  1. When typing, anywhere in the GUI, though most noticeable in a Terminal prompt, there is, sporadically, frequently, a delay of 1 to 3 seconds before a typed letter will appear on the screen. For example, one would type 'dddd' and the second 'd' may appear after 1 to 3 seconds whereas the others appear sub-second.
  2. The issue is not related to system load (low or no system load) nor performance (high end workstation)
  3. The issue is not related to Accessibility options (all turned off) or similar configurable settings
  4. Importantly, when dropping to a non-GUI shell (ctrl+alt+F4) the issue is not present
  5. The issue may be Ubuntu inherited and may possibly be connected with using a recent NVIDIA driver, but these are not confirmed
  6. The issue seems to have existed in older versions of Mint/XFCE also, though it is more pronounced in Mint 21
  7. The issue is not related to which key is pressed. However, typing in a terminal prompt - spaces and the letter d for example - will start to show the issue after a number of tries. Also, seemingly more when further down the same line (for example after 30 orso typed characters) rather than at the start of a line
  8. Running xev -event keyboard and then pressing (and immediately releasing) "d" repeatedly shows that - even when the issue happens, the processing time of the KeyPress to KeyRelease event is still only 100-120 ms, however the "KeyRelease event" will not immediately display (and take 1-3 seconds delay) indicating that something after the KeyRelease event is causing the delay. Hopefully this will aid in narrowing down the issue
  9. The issue is, as far as can be observed, not related to any keylogger, virus, malware or similar security concern
  10. The issue does not seem related to any other software running on the machine
  11. Many attempts at fixing it (including very advanced troubleshooting things like changing the keyboard poll value in /sys/module/usbhid/parameters/kbpoll and adding things like usbhid.kbpoll=1 usbhid.mousepoll=1 to GRUB) have not yielded any positive results and the issue remains

The issue is truly heartbreaking and makes Mint 21 + XFCE almost unworkable. Please help.

Edited by Roel Van de Paar