Peter Hutterer of X input fame in a post on X input grabs:

“If you think all this is confusing, look at the code that implements this :)
Also note that this post skips on a number of details and contains some amount of handwaving and sticking fingers in your ears and going “lalalala”.”