<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>I tried to do something similar and had the same experience. I still don't know how to convert keyboard events to something useful like UTF-8. (I was actually aiming for Latin-1 to start with).<br></div><div><br></div><div>My terrible code is here:<br></div><div><a href="https://github.com/abainbridge/deadfrog-lib/blob/master/src/df_window_x11.cpp">https://github.com/abainbridge/deadfrog-lib/blob/master/src/df_window_x11.cpp</a><br></div><div><br></div><div>The keycode conversions are done in x11KeycodeToDfKeycode() and dfKeycodeToAscii().<br></div><div><br></div><div>If someone would like to tell me (and John) how to do better, that'd be great, as long as it doesn't involve adding any dependencies to my code :-)<br></div><div><br></div><div>- Andy<br></div><div><br></div><div>On Sun, Feb 13, 2022, at 5:01 PM, John Found wrote:<br></div><blockquote type="cite" id="qt" style=""><div>Hi. <br></div><div><br></div><div>I am trying to create a X client that to communicate to X server by the<br></div><div>raw protocol, not using any libraries, such as XLib or XCB.<br></div><div><br></div><div>While with the graphics part it was simple and straightforward task,<br></div><div>solved by simply following the protocol (The documentation on X11 is<br></div><div>pretty complete and well written) and extensions documentation is<br></div><div>available (although the MIT-SHM documentation on the protocol does not<br></div><div>exists at all), I have stuck with the keyboard part of<br></div><div>the protocol.<br></div><div><br></div><div>The biggest problem is the conversion from the keycodes into the<br></div><div>Unicode characters (of course where it is possible).<br></div><div><br></div><div>Do I need XKEYBOARD extension? On only XINPUT. Or both. The<br></div><div>documentation is complex and poorly written. I have a feeling that part<br></div><div>of it was written not to be useful, but simply because it had to be<br></div><div>written.<br></div><div><br></div><div>So, the question: <br></div><div><br></div><div>What is the simplest, canonical, expected way to handle the keyboard<br></div><div>events in X protocol in order to obtain the Unicode codes of the<br></div><div>pressed keys? In raw protocol therms. And supporting multiple<br></div><div>languages, of course. <br></div><div><br></div><div>I understand that some processing on the client side is required, but I<br></div><div>am missing the whole picture of the process.<br></div><div><br></div><div>Best Regards.<br></div><div>John Found<br></div><div><br></div></blockquote><div><br></div></body></html>