I have started doing a deep dive into the code and have left some comments and questions. I am still only half-way through the series, and there are a few aspects of this MR (esp. second half) I am not familiar with, so some more reading is in order.
It's great that you have introduced a nice solution in Wine core for the client side key repeat functionality!