https://bugs.winehq.org/show_bug.cgi?id=57442
--- Comment #3 from ksmnvsg@gmail.com --- (In reply to RĂ©mi Bernon from comment #2)
The issue is probably coming from the X11 driver throttle that is in place, and only allow peeking into X11 events every ms. When events are received faster, the X11 driver will start queuing them, and eventually merge inputs events together before sending the input through wineserver to the application.
The input event merging is probably also adding more effective latency, but removing it without checking for X11 events more often, will simply cause batches of events to be sent every 1ms, and won't make much difference.
Removing the throttle will cause applications that use a pattern like this to storm X11 with XCheckIfEvent calls for nothing. This has been causing heavy system loads and we want to prevent that. We could allow slightly more frequent calls, but I don't think we can remove the throttle and we could need a different user driver design instead [*].
[*] I had the idea to move the X11 input event polling elsewhere, possibly in wineserver, but this would be a very large architectural change.
I've replaced the throttling method based off ticking with the one that Wine had before 9.13 version (based off number of messages) and this latency is gone. It's hard to measure if my CPU usage increased since my application is pretty small, but it didn't skyrocket at least, although it's better to test it with a CPU-heavy game.
I also wanted to look into X11 code, but then I figured even if I do find something, rebuilding X11 it would be a nightmare for me.