I've just finished writing an essay where I talk about my recent experiments with X and managing keyboard events. If you've had similar experiences or have any thoughts to share that could help clarify things even more, I'd really like to hear your thoughts.
I have just read your README.md file and found your repo interesting indeed. The README is well written. I knew it was possible to read and parse /dev/input/* files, but was hesitant to get into the intricacies you described.
Anyway, great job sir! Now I will read your code out of curiosity :)