On Mon, 21 Jan 2002 12:19:09 +0000 Paul Williams <[EMAIL PROTECTED]> wrote: > > I'd like to hear more from the original poster about the requirement for > this encoding, and why it would need to be transparent to Linux console > and PuTTY. Without wishing to be rude, I think the problem should be > defined before the solution.
I'm writing a text mode application framework called Terminal MVC that reads an XML screen definition to get a DOM tree (the Model), around which it renders Views much like the Java AWT or the BView class from Beos but with box and line drawing characters, for which the root viewport is the terminal window (the View), and uses NON-neumonic < 10 key easy navigation based around Enter, Esc, and cursor keys (the Controller). If a C module is specified in a frame tag it's is dlopen'd and initialized passing the DOM tree onto which event hanlders can be registered. My intention is that it be the easiest way to write a UI for a C program. The model and recusrive composition of frames and basic text are stable enough for me to move onto the Controller. I want to be able to use the Print Screen key to render the current UI on the postscript display device and sent to the printer. For the text component I want to be able to hold the shift key down while I hit the up arrow key to select entire lines of text. To do this I must be able to detect key releases. Terminal MVC will be most useful for Linux configuration applications running on servers, or POS like applications running remotely from cheap PCs. Servers don't have X Windows so I want this to work on the Linux console. Admins like administering there boxes from PuTTY on there Windows workstation too. As for the requirement of the encoding, I do not want to encode keycodes or scancodes as Thomas thought. The original 5 minute hack to xterm that I sent him did this. I want to encode UCS codes corresponding to the KeySym of the keycode. In other words, I want the X server to do as much work for me as possible because it knows all about the users keyboard and custom mappings etc. So I just need to convert the KeySym to Unicode. The Xutf8LookupString is the way you normally do this but it doesn't work with KeyReleasedEvents for some reason. Control keys will require additional representation. All of these UCS key syms will be augmented with an extra bit of information to indicate that the key associated with the UCS code was released as opposed to pressed. I do not believe I need to communicate modifiers although it might be nice if there's space left over. I have tried without success to find information on these DEC terminals Paul speaks of but the client X server on which the end user program is being displayed has already worked out the keyboard layout and other platform specific issues so I don't think this is the direction I want to take anyway. Same thing, for PuTTY, it knows it's operating in a PC environment, so we can just convert to UCS codes there. The point being the clients handle all the portability issues. The end user program can now just use the UCS codes and a few constants for control keys. So ideally, I want to take a keycode and convert it to a KeySym with modifiers applied and then sent UCS codes with the high bit on if it's a release. Of course I don't know for sure if that will work but I wouldn't be asking these fandangled questions here if I did ;-) xterm-165-ksym2.patch and sample ksym.c program attached. Thanks, Mike -- May The Source be with you.
xterm-165-ksym2.patch
Description: Binary data
ksym.c
Description: Binary data